Hi,
Forgive me as this will probably be so simple for most of you but my searches haven't returned anything that I can use and my knowledge is limited to an extent in VBA.
I have several lines of code that require certain rows numbers to be used:
This is used in a macro that copies certain specific rows from one sheet to another (Rows("5:17")) in the above example.
These rows numbers change and I'd like to declare a variable at the start of the macro to make amending easier rather than scrolling dwon through the code looking for them.
The second thing I use is another code string to remove the rows within the same macro (it's along winded explanation that I won't go into) and this looks like:
If anyone knows how I can declare at the beginning the variable and value to replace the 5:17 it would be much appreciate. I am envisioning something like this:
Any help greatly appreciated and thank you for your time.
Mark.
Forgive me as this will probably be so simple for most of you but my searches haven't returned anything that I can use and my knowledge is limited to an extent in VBA.
I have several lines of code that require certain rows numbers to be used:
Code:
'Copys The Row Specified
Sheets("This IS Sheet 1").Rows("5:17").Copy
This is used in a macro that copies certain specific rows from one sheet to another (Rows("5:17")) in the above example.
These rows numbers change and I'd like to declare a variable at the start of the macro to make amending easier rather than scrolling dwon through the code looking for them.
The second thing I use is another code string to remove the rows within the same macro (it's along winded explanation that I won't go into) and this looks like:
Code:
Rows("5:17").Delete
If anyone knows how I can declare at the beginning the variable and value to replace the 5:17 it would be much appreciate. I am envisioning something like this:
Code:
Dim MyRows1 as variable
MyRows1 = "5:17"
Sheets("Debt Remedy Template Steps").Rows("MyRows1").Copy
Rows("MyRows1").Delete
Any help greatly appreciated and thank you for your time.
Mark.