Attached have a wbook with OLD and NEW sheet.
Bsaed the first date (in old sheet) 20100531 and last 20100604 (column K & N) how to insert a new missed column (in column M) with date 20100602...
INSERT new column based step date
-
- Administrator
- Posts: 78563
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: INSERT new column based step date
Try this:
Code: Select all
Sub InsertCols()
Dim wshOld As Worksheet
Dim wshNew As Worksheet
Dim s As Long
Set wshOld = Worksheets("TEST_OLD")
Set wshNew = Worksheets("TEST_NEW")
s = 11 ' column K
Do While wshNew.Cells(2, s) <> ""
If wshNew.Cells(2, s) <> wshOld.Cells(2, s) Then
wshNew.Cells(2, s).EntireColumn.Copy
wshOld.Cells(2, s).EntireColumn.Insert
End If
s = s + 1
Loop
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4364
- Joined: 26 Apr 2010, 17:36
Re: INSERT new column based step date
exactlly wath i need! Tks as usual.HansV wrote:Try this:
Code: Select all
Sub InsertCols() Dim wshOld As Worksheet Dim wshNew As Worksheet Dim s As Long Set wshOld = Worksheets("TEST_OLD") Set wshNew = Worksheets("TEST_NEW") s = 11 ' column K Do While wshNew.Cells(2, s) <> "" If wshNew.Cells(2, s) <> wshOld.Cells(2, s) Then wshNew.Cells(2, s).EntireColumn.Copy wshOld.Cells(2, s).EntireColumn.Insert End If s = s + 1 Loop End Sub