Hi All,
Im trying to put together some VBA that will offset a column based on a value in a named cell
Below is the complete coding i have.
Sub ImportMonthlyHardData()
'Imports the Hard Totals from the Saved file in the Import Folder
Dim HardRange As Range
Dim CurMonth As Integer
Sheets("TaskDataValues").Select
Range("TotalHard").Select
Range("TotalHard").Copy
ActiveWorkbook.Activate
Sheets("DataPage").Range("HardRange").Offset(0, Range("CurMonth").Value).Select
ActiveSheet.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub
Sheets("DataPage").Range("HardRange").Offset(0, Range("CurMonth").Value).Select
This line is the one that is causing me problems
This is doing my head in.
Would it be easier to do If Statements
CurMonth = 1 than use Range("HardRange").Offset(0,1)
CurMonth = 2 than use Range("HardRange").Offset(0,2)
Any help is appreciated. This will make my life a whole lot easier.
CurMonth is the named cell in my parameters page which is a linked cell from a drop down menu which changes based on the field selected. I.e. If march Selected it will put the 3 in the field. Which then in turn when running the import macro i would like it to offset 3 columns to the left from the specified range.
IDea's or tips would go along way!!!
Cheers
Graeme
Bookmarks