Lavina

Board Regular
Joined
Dec 18, 2018
Messages
75
Hey guys,

I'm creating a user form with some buttons, currently i have:

Initialize label with name:

Sub UserForm_Initialize(populatingArray() As Variant, positionOfOverWrite As Integer)
Dim UserForm As Variant
UserForm.Caption = "Data found!"
Call UserFormCaption(populatingArray(), positionOfOverWrite)
End Sub


Caption the rest of the labels:

Sub UserFormCaption(populatingArray() As Variant, positionOfOverWrite As Integer)
LabelOverWriteDescription.Caption = ("Overwriting data at workbook:'" + CStr(populatingArray(positionOfOverWrite, 4)) + "', sheet: '" + CStr(populatingArray(positionOfOverWrite, 5)) + "' cell: row " + CStr(variableInQuestionRow) + ":column " + CStr(variableInQuestionColumn))
CommandButtonOverWriteOne.Caption = "Overwrite this"
CommandButtonOverWriteAll.Caption = "Overwrite all"
CommandButtonOverWriteCancel.Caption = "Cancel"
End Sub



Now when I try to initialize the with a function that carries over the array:

Call UserForm_Initialize(populatingArray(positionOfOverWrite, 4), i)

I get the error that no function or sub defined

Only way i found to open the form:
UserFormOverWrite.Show vbModeless

But with this function i do not move over my array

Why doesn't my module see the subs defined in the form? Is there some other way i need to initialize the user form?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Userform initialize is a userform event that happens when the userform is shown. U seem to be making your own sub.... it has nothing to do with the initialize event (unless U call it from userform initialize event). Anyways, I suspect that your subs are in the userform code. Place them in module code with "Public" in front of them (ie. Public Sub UserForm_Initialize(populatingArray() As Variant, positionOfOverWrite As Integer) ). U can then Call them from wherever. HTH. Dave
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top