gheyman
Well-known Member
- Joined
- Nov 14, 2005
- Messages
- 2,341
- Office Version
- 365
- Platform
- Windows
I have a value that tells me how many columns to the right of cell J3 I need to paste a formula.
How do I code this to do that? I also need to delete all the columns after that number of columns
So if in Sheets("Material Distribution Spread").Range("I2").Value I have the value of "6"
I need code that would paste in the below formula starting in K3 over 4 columns to O3 (Yes, 1 less then the value in I2)
Then I need to delete any columns that may exist to the right of column 0 (in this instance).
Your help is very mush appreciated.
How do I code this to do that? I also need to delete all the columns after that number of columns
So if in Sheets("Material Distribution Spread").Range("I2").Value I have the value of "6"
I need code that would paste in the below formula starting in K3 over 4 columns to O3 (Yes, 1 less then the value in I2)
Then I need to delete any columns that may exist to the right of column 0 (in this instance).
Your help is very mush appreciated.
Code:
Sub SetFirstMonth()
'************
'Set First Month on Material Distribution tab
'*********************************************
Sheets("Material Distribution").Range("J2").Value = Sheets("Material Distribution Spread").Range("G2").Value
'Note J2 is a date
Dim NumMonths As Long
NumMonths = Sheets("Material Distribution Spread").Range("I2").Value
'???? Cells(2, 10).FormulaR1C1 = "=EDATE(R2C10,(COLUMN()-COLUMN(R2C10)))"
End Sub