Hello all,
While I've been an avid browser for years, this is my first posting of a question to any forum ever. I normally google search my problem, as most problems have occured before, but I'm having trouble getting this one to work specifically. Any help would be appreciated.
I'm creating a macro to populate an inventory workbook with 32 sheets on a daily basis (Sheets = 1, 2, 3, ..., 31, Data). The idea is, a report is copy/pasted into the Data sheet (daily) and then the macro populates the data into the appropriate Day sheet (daily). So I need code to select the appropriate Sheet, based upon a date given in the data.
'**Tried having the value stored, as opposed to the formula that exists in R1 (R1=DAY(A1)).**
Sheets("Data").Select
Range("R1").Select
Selection.Copy
Range("R2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Dim DayNum As Long
Worksheets("Data").Activate
DayNum = Cells(2, "R").Value
Range("R3") = DayNum '****this works so I know DayNum exists
Sheets("DayNum").Select
'**Currently, R2 contains the value "1" and I have a Sheet names "1"**
The last line, selecting the appropriate sheet, is where it fails; I receive a "run-time error". I have tried various forms of formatting on R2 (text, general, number) to no avail.
Again, thank you in advance to help a fledgling programmer.
Sevy
While I've been an avid browser for years, this is my first posting of a question to any forum ever. I normally google search my problem, as most problems have occured before, but I'm having trouble getting this one to work specifically. Any help would be appreciated.
I'm creating a macro to populate an inventory workbook with 32 sheets on a daily basis (Sheets = 1, 2, 3, ..., 31, Data). The idea is, a report is copy/pasted into the Data sheet (daily) and then the macro populates the data into the appropriate Day sheet (daily). So I need code to select the appropriate Sheet, based upon a date given in the data.
'**Tried having the value stored, as opposed to the formula that exists in R1 (R1=DAY(A1)).**
Sheets("Data").Select
Range("R1").Select
Selection.Copy
Range("R2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Dim DayNum As Long
Worksheets("Data").Activate
DayNum = Cells(2, "R").Value
Range("R3") = DayNum '****this works so I know DayNum exists
Sheets("DayNum").Select
'**Currently, R2 contains the value "1" and I have a Sheet names "1"**
The last line, selecting the appropriate sheet, is where it fails; I receive a "run-time error". I have tried various forms of formatting on R2 (text, general, number) to no avail.
Again, thank you in advance to help a fledgling programmer.
Sevy