PDA

View Full Version : Inserting Column Based On Text



Justinbodden
09-18-2015, 07:07 AM
Hi All-

Can someone please help to get VBA code to find specific text in row and insert column after the specific text.

Find Text : "Country"

Thank you!

JB

mancubus
09-18-2015, 07:47 AM
try


With Worksheets("MySheet") 'change MySheet to suit
.Columns(.Cells.Find("Country").Column + 1).Insert
End With


because other arguments of the range.find method not stated, 'find' uses the defaults and finds the first occurence of "country" in worksheet.

more on find method:
https://msdn.microsoft.com/en-us/library/office/ff839746.aspx

Justinbodden
09-18-2015, 08:14 AM
Thanks so much bro!