Copy headin

D

David T

I have a code that replaces anything in the column with a "+" with the column
heading name, however I cannot get the code to move to the next column and do
the same thing. Can anyone help>

Sub InsertRow()

Application.ScreenUpdating = False

lrow = Range("A" & Rows.Count).End(xlUp).Row

For i = lrow To 2 Step -1
c = 12
If Cells(i, c).Value Like "*+*" Then Cells(i, c).Value = Cells(1, c)

Next i
End Sub
 
L

Luke M

'Try this:

Sub InsertRow()

Application.ScreenUpdating = False

'How many columns to look at?
For x = 1 To 25 Step 1

lrow = Cells(Rows.Count, x).End(xlUp).Row

For i = lrow To 2 Step -1

If Cells(i, x).Value Like "*+*" Then _
Cells(i, x).Value = Cells(1, x)

Next i

Next x
End Sub
 

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