First Last

First Last

  • NA
  • 648
  • 71.5k

Build a string as part of the VBA command syntax

May 1 2023 5:53 PM

Dim buttonName As String

buttonName = columnCellLetter & "14"

I have a command:

   Me.ActiveSheet.ButtonB14.ForeColor = &HFF&

but I want to make the 'ButtonB14' part to be dynamic.

Like: Me.ActiveSheet.&buttonName&.ForeColor = &HFF&

How do I do that?

 


Answers (5)