Find a cell value in a column then add two rows above

  • Thread starter Cynthia Gregory
  • Start date
C

Cynthia Gregory

I know I have done this in the past and you guys haved helped me with it,
but for the life of me I cannot find it. I have a spreadsheet that I have
to "manually" format every week and am working on creating a macro to do
this. I have run into a problem and need assistance.

I have a value that will always be in a column that has been joined with two
other columns. They are columns h, i and j. I am taking data from an
internal website html page and copying that date and pasting it into excel,
so this field is already set as a "joined" column. The data in that field
will always read "Product(s):" What I need to do is search the worksheet
for this value and then add two empty rows just above the row that the data
was found. Can anyone please send me in the right direction. I really need
to get the VBA code that could help me with this search and add.

Thanks everyone for your consideration of helping me.
Cynthia Gregory
 
G

Guest

Something like this...

Dim rngFound As Range

Set rngFound = Range("A:A").Find(What:="Product(s):", _
LookAt:=xlWhole, _
LookIn:=xlFormulas, _
MatchCase:=False)
If rngFound Is Nothing Then
MsgBox "Product(s): was not found"
Else
rngFound.EntireRow.Resize(2).Insert
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top