Please help! with find/copy/replace

K

ksquirt

I have tweaked a macro to do all kinds of new things thanks to searchin
for answers on this forum. My current issue is that it is skipping
cell. It skips the first '90601' and doesn't copy it. Thanks i
advance for any help and advice!!

Dim LSearchRow As Integer
LSearchRow = 1


While Len(Range("A" & CStr(LSearchRow)).Value) > 0

'If Column D = "90601", copy entire row
If Range("D" & CStr(LSearchRow)).Value = "90601" Then
Range("D" & CStr(LSearchRow)).EntireRow.Copy
'Insert copied Row below the original
Range("D" & CStr(LSearchRow)).EntireRow.Insert Shift:=xlDown
'Change values in Columns D on new row to 20150
Range("D" & CStr(LSearchRow + 1)) = "20150"
End I
 
P

pascal baro

Your code misses the first value "90601" because on the same row of the missing value, column A is empty or len...= 0
 

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