spencer_time
Board Regular
- Joined
- Sep 19, 2019
- Messages
- 55
- Office Version
- 365
- 2016
- 2007
- Platform
- Windows
Hello, I have some test code that I can't get to work correctly. I am trying to figure out if it's possible to use a variable within an excel function, and if so, the proper way to do that.
The following is what I currently have, it is not working:
If any of you know how to do this properly, any advice would be appreciated.
(the end use will be within a large spreadsheet that imports files to sheets, names those sheets after the filename of the originating file, and performs operations on the sheets with regard to the file name{which is in the format 01CEQ09, and the first two numbers will be extracted into a variable and used for further sorting and operations})
Thanks in advance for any advice.
The following is what I currently have, it is not working:
Code:
Sub embedVarFunc()
Dim rng As Range
Dim num As Integer
num = 1
Set rng = Sheet&num.Range("A1").CurrentRegion 'attempt to use variable as part of function
MsgBox rng.Address
End Sub
If any of you know how to do this properly, any advice would be appreciated.
(the end use will be within a large spreadsheet that imports files to sheets, names those sheets after the filename of the originating file, and performs operations on the sheets with regard to the file name{which is in the format 01CEQ09, and the first two numbers will be extracted into a variable and used for further sorting and operations})
Thanks in advance for any advice.