Inserting cells using VBA

  • Thread starter Thread starter Sreedhar
  • Start date Start date
S

Sreedhar

Hi,

I want a macro that inserts cells at column "F" and shifts the cells right
<IF> the cell value at column "H" meets certain criteria.

something like:
For each cell in Range(H1:H3500")
If IsNumeric(cell.value) Then 'only numbers, nulls
excluded
''''Insert three cells at "F" and shift right
End If
Next cell

Thanks
 
For RowCount = 1 To 3500
If IsNumeric(Range("H" & RowCount).Value) Then
Range("F" & RowCount).Insert Shift:=xlToRight
End If
Next RowCount
 
Hi

Try this:

Dim cell As Range
For Each cell In Range("H1:H3500")
If IsNumeric(cell.Value) Then 'only numbers, nulls excluded
cell.Resize(1, 3).Insert Shift:=xlShiftToRight
End If
Next cell

Regards,
Per
 
Thanks. that works.
--
Sreedhar


Joel said:
For RowCount = 1 To 3500
If IsNumeric(Range("H" & RowCount).Value) Then
Range("F" & RowCount).Insert Shift:=xlToRight
End If
Next RowCount
 
Back
Top