Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can I run the same macro or Subroutine from different Cells.
for example I want the Macro 'MyMacro()' to use the value in the cell. However I'm Not sure how to pass the string value in the cell to the macro If Cell A1 had 'Supplier' MyMacro would look like this =MyData(A1) I want to use the same Subroutine for other Cell value for example If Cell A2 has 'Customer' MyMacro would look like this =MyData(A2) -- Jeff |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Either this...
call MyMacro(Range("A2")) Public Sub MyMacro(ByVal Cell As Range) MsgBox Cell.Value End Sub or.... call MyMacro("A2") Public Sub MyMacro(ByVal Cell As String) MsgBox Range(cell).Value End Sub -- HTH... Jim Thomlinson "Jeff" wrote: Can I run the same macro or Subroutine from different Cells. for example I want the Macro 'MyMacro()' to use the value in the cell. However I'm Not sure how to pass the string value in the cell to the macro If Cell A1 had 'Supplier' MyMacro would look like this =MyData(A1) I want to use the same Subroutine for other Cell value for example If Cell A2 has 'Customer' MyMacro would look like this =MyData(A2) -- Jeff |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA macro runs fine, but freezes if I try to do ANYTHING else whileit runs | Setting up and Configuration of Excel | |||
Macro that runs when a cell is selected | Excel Discussion (Misc queries) | |||
VLOOKUP anchored cell reference changing when macro runs | Excel Discussion (Misc queries) | |||
macro runs if I Clear a cell | Excel Programming | |||
macro runs if I Clear a cell | Excel Programming |