T
TBA
Excel 97, Windows 2k Pro
I have a custom toolbar with one button on it. Clicking the button executes
a macro. The macro calls a userform, and the userform does (err...will do)
a variety of things.
I am confused on where I need to put certain blocks of code. For instance,
when the form loads I would like it to do some basic things like declare
some variables that will be used by command buttons, load a list of column
headers into a one dimensional array, display a message box and establish
the range I will be working with. Here is an example of something I'd like
to happen when the form loads. As you can see the way it is now it happens
when I click on a command button:
Private Sub cmd3_typecheck_Click()
Dim Headers(100) as String
i = 0
For Each cell In Range("Database").Rows(1).Cells
i = i + 1
If i < 30 Then
Headers(i) = cell.Value
MsgBox "header " & i & ": " & cell.Value
End If
Next
End Sub
I can get all these things to work via command buttons, but i was hoping the
actual "loading" of the form was an event that could receive code. A
worksheet event maybe?
I also seem to be having a problem saving my work. Do forms and modules
need to be saved separately from the workbook? Does working with dbf files
in Excel present any special circumstances with regards to forms and macros?
All help appreciated, thanks!
-glenn-
I have a custom toolbar with one button on it. Clicking the button executes
a macro. The macro calls a userform, and the userform does (err...will do)
a variety of things.
I am confused on where I need to put certain blocks of code. For instance,
when the form loads I would like it to do some basic things like declare
some variables that will be used by command buttons, load a list of column
headers into a one dimensional array, display a message box and establish
the range I will be working with. Here is an example of something I'd like
to happen when the form loads. As you can see the way it is now it happens
when I click on a command button:
Private Sub cmd3_typecheck_Click()
Dim Headers(100) as String
i = 0
For Each cell In Range("Database").Rows(1).Cells
i = i + 1
If i < 30 Then
Headers(i) = cell.Value
MsgBox "header " & i & ": " & cell.Value
End If
Next
End Sub
I can get all these things to work via command buttons, but i was hoping the
actual "loading" of the form was an event that could receive code. A
worksheet event maybe?
I also seem to be having a problem saving my work. Do forms and modules
need to be saved separately from the workbook? Does working with dbf files
in Excel present any special circumstances with regards to forms and macros?
All help appreciated, thanks!
-glenn-