Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to pass a named range (or even an unnamed block of cells) into
a macro? I have written a macro that I want to use for several different ranges of data. I have created multiple buttons that each call the macro, but I cannot seem to find the right syntax to pass in the range of data that I want the macro to use for each button. All I can do is to pass in the row and column numbers that define the upper left and lower right corners of the data range, as follows: Private Sub CommandButton1_Click() ' Call Macro1(UpperLeftRow, UpperLeftCol, LowerRightRow, LowerRightCol) Call Macro1(16, 9, 40, 35) End Sub Private Sub CommandButton2_Click() Call Macro1(51, 9, 75, 35) End Sub etc. If possible, I would like to be able to specify named ranges instead, so that I don't have to edit the code for all the buttons if I add, delete or move rows or columns. Is there a way to do this? Thanks! hjc |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
named range in macro call | Excel Programming | |||
Named Range Macro | Excel Discussion (Misc queries) | |||
Trying to call a macro on selection of a cell in a range | Excel Programming | |||
Call Macro when Cell within Range Changes | Excel Programming | |||
Passing a range in a macro call | Excel Programming |