VBA Userform Question - Commandbuttons

orangefury90

New Member
Joined
Sep 21, 2013
Messages
11
I think my previous post was too long and confusing...

I can not seem get the below code in red to work. I am trying to change commandbuttons (R1C1, R1C2, R1C3, R1C4 etc) to change their captions to text that is already saved into an array without making a hundreds of lines of code.

Dim button_array(0 To 24, 0 To 2) as string

'Update button captions with information from array
for i = 1 to 5
for j = 1 to 5
update_log_form.R(i)C(j).caption = button_array(i,0)

next j
next i

Thanks in advance!!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
If anyone is interested, I figured it out. Here is the code when deciding if the command button is hidden or not:

Dim button As msforms.CommandButton

For i = 1 To 5
For j = 1 To 5
Set button = update_log_form.Controls("R" & i & "C" & j)
button.Visible = True
Next j
Next i
 
Upvote 0

Forum statistics

Threads
1,216,750
Messages
6,132,499
Members
449,730
Latest member
SeanHT

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