Created
October 27, 2017 01:49
-
-
Save richard512/1ef6430dfdb1e3062d629f60b3963c97 to your computer and use it in GitHub Desktop.
Finds last column value in the first row and makes a date column from it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub MakeDateColumn() | |
If Range("A1").Value = "Date" Then | |
MsgBox "Already have Date column" | |
Exit Sub | |
End If | |
With Range("A1:Z1") | |
Set c = .Find(2, LookIn:=xlValues) | |
If Not c Is Nothing Then | |
strDate = c.Value | |
End If | |
End With | |
Range("A1").EntireColumn.Insert | |
Range("A1").Value = "Date" | |
LastRow = Range("B" & Rows.Count).End(xlUp).Row | |
Range("A2:A" & LastRow) = strDate | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment