You are here:

Visual Basic/Programming User Form

Advertisement


Question
Hi Ravindra,

My Knowledge is very limited.

I have a user from set up and want it to get information from a sheet called "datadase". I have the below code but i can't get it to display the information in the Cell range on the user for.
Not sure what i am doing wrong

Private Sub PPMB1()
   UserForm1.Show
   TextBox1 = Worksheets("Database").Range("A4")
   TextBox2 = Worksheets("Database").Range("B4")
   TextBox3 = Worksheets("Database").Range("S4")
End Sub


Thanks in Advance
Mark


Answer
for this the excel sheet needs to be open
then you can put this code with changes as required

create a macro called say Macro1
and add this code

Sub Macro1()

UserForm1.TextBox1 = ActiveSheet.Cells(1, 1)
UserForm1.TextBox2 = ActiveSheet.Cells(1, 2)
UserForm1.TextBox3 = ActiveSheet.Cells(1, 3)
UserForm1.Show

End Sub


run the macro from an icon on toolbar

Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


Ravindra

Expertise

visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel.(VB6) basic questions in vb 2008. Optional: 1)a large number of people want me to do work which takes some time and effort. can do projects in vb 2008. Pl.note that i would like to be paid for such work. 2) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 3) if you are pleased with my reply you could consider a good amount. 4) you can visit my website http://ravindra.coolpage.biz

Experience

programming since the past 15 years. have completed a large number of projects in Industrial applications, finance,accounts, correspondence. excel macros etc

Education/Credentials
engineering, management degrees.

Past/Present Clients
project work for a Norway company,USA company and a Canadian company completed. Freelance Project work and Teaching. helping programmers with their work
teaching vb

©2012 About.com, a part of The New York Times Company. All rights reserved.