View Full Version : Solved: Need help creating macro to insert col
cgannm
06-25-2008, 03:18 PM
Hi, I am seeking your help with creating a macro that will delete a Col C, insert a Col A, then name it,then populate the rows to end of data in next col with user input.
Please see example in attachment.
Thanks,
cgannm 9212
Bob Phillips
06-25-2008, 03:48 PM
Sub SomeCode()
Dim myInput As Variant
myInput = InputBox("Insert what type?")
If myInput <> "" Then
Columns(3).Delete
Columns(1).Insert
Range("A1").Value = "Tray"
Range("A2").Resize(Range("B2").End(xlDown).Row).Value = myInput
End If
End Sub
cgannm
06-26-2008, 09:49 AM
Hi, Xid,thanks for helping. I am have one slight problem with "A2". The input value is populating one too rows. For example, "B2" has data up to row 10, script populates "A2" up to Row 11.
Thanks
Bob Phillips
06-26-2008, 02:43 PM
Slight mod
Sub SomeCode()
Dim myInput As Variant
myInput = InputBox("Insert what type?")
If myInput <> "" Then
Columns(3).Delete
Columns(1).Insert
Range("A1").Value = "Tray"
Range("A2").Resize(Range("B2").End(xlDown).Row - 1).Value = myInput
End If
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.