View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Executing two statements in a for loop

Sub rechercheFinale2()
Dim cell As Range
Dim index As Integer
index = 11
For Each cell In Range("H11:H402")
If IsNumeric(cell.Value) Then
cell.Value.Copy Worksheets("Sheet1").Cells(index, "I").Value
index = index + 1
End If
Next cell
End Sub



--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


wrote in message
oups.com...
Hey guys I am new at macos

I basically have a column with both numbers and blank cells (column H).
I am trying to recognize only the numbers and copy them in the adjacent
column one after another.
When the cell is actually a number, I would like to increment a counter
starting from cell i11.
If I try to add a second If statement in the for loop for the sole
purpose of incrementing the counter I get an error

here is the code:

Sub rechercheFinale2()
Dim cell As Range
Dim index As Integer
index = 11
For Each cell In Range("H11:H402")
If IsNumeric(cell.Value) = True Then
Worksheets("Sheet1").Rows(index).Columns(9).Value = cell.Value
index = index + 1
Next cell
End Sub



thank you guys