Home Creating a new column title in VBA
Reply: 0

Creating a new column title in VBA

user676
1#
user676 Published in April 21, 2018, 3:34 pm

I have a spreadsheet which looks like the below:

I am trying to write a macro (and ultimately a button) which will create a new column with the current date as a header in the first empty column i.e. next to april it will say May if I run it when it is May.

This is what I have tried so far, but it doesn't work:

Sub column()

Dim Input_ID As String, Date_in As String
Dim ws As Worksheet

Set ws = ThisWorkbook.Sheets("Facebook")
Date_in = Format(Now, "MMM-YY")

With ws.Range("2" & ws.Columns.Count).End(xlUp)
    If .column >= c Then .Offset(1, 0).Value = Date_in Else Exit Sub
End With

End Sub
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.309485 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO