New to me

  • Thread starter Thread starter Striker
  • Start date Start date
S

Striker

I am kind of new to VBA. I picked up a book and will try to figure it all
out. In reading through some of the posts, this board looks like a good
place to ask questions. Please let me know if there is a better one.

Question. In Excel 2002, I want to load a form that copies text data from a
row of cells into a form. So my first question is how do I load the form I
created? What I did is add a module with one sub that just loads the form
into memory, like below....

Sub LoadForm()
Range("A2").Select
Load frmMain
End Sub

Then I was thinking about putting code to copy cells of data into text boxes
using the offset method from "A2" in the Form Initialize event.

I want the user to manually start the form, so am I on the correct track
with where I'm going?
 
Sub LoadForm()
Range("A2").Select
frmMain.Show
End Sub

would load and show the form.

It sounds like you are going in the right direction.
 
Striker said:
I am kind of new to VBA. I picked up a book and will try to figure it all
out. In reading through some of the posts, this board looks like a good
place to ask questions. Please let me know if there is a better one.

Oh yeah, the one across the road is much better, that is why we are all
here.

No, this is the best. No ifs, no buts, the best. You get Tom Ogilvy here,
occasionally Rob Bovey and Stephen Bullen, Harlan Grove checks in
occasionally, Ron de Bruin, Dave Peterson, Norman Jones, Jim Cone, Papou,
Michael Pierron, Chip Pearson, KJon Peltire, Jan Karel Pieterse,... It
doesn't get an y better than this
Question. In Excel 2002, I want to load a form that copies text data from a
row of cells into a form. So my first question is how do I load the form I
created? What I did is add a module with one sub that just loads the form
into memory, like below....

Sub LoadForm()
Range("A2").Select
Load frmMain
End Sub

Sub LoadForm()
Load frmMain
With frmMain
.Textbox1.Text = Range("A2").Text
.Textbox2.Text = Range("A2").Offest(1,0).Text
.Textbox3.Text = Range("A2").Offest(2,0).Text
'etc.
.Show
End With



End Sub
 
WOW great response. OK now I am putting a command button to move to the
next row and put text from that row into the test boxes. I think I can use
the offset method to do this, but I need to be careful in case someone has
changes the text in the form, I need to copy to the spreadsheet.

From reading thru this forum I was thinking about setting a variable (bool)
to make the form dirty. Perhaps bDirty as booleen. Would this be a global
variable in the module, or could it be a global variable in the form?
 
Probably best in the module, a standard module, not a worksheet module.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Loading Userform 3
Loading Userform Errors 1004 4
Excel VBA help: Text file formatting 19
Access Form Refresh 1
Using Forms to Update Worksheet Data 1
User Form Problem 2
Get rid of need for F2.Select 3
Save Array in memory 5

Back
Top