View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mangesh Mangesh is offline
external usenet poster
 
Posts: 18
Default How to write a statement about if then

run this macro:

Private Sub CommandButton1_Click()

Set rngSource = Sheet1.Range("A1:C5")
Set rngDest = Sheet2.Range("A1")

j = 1
For i = 1 To rngSource.Rows.Count
If rngSource(i, 1) = 1 Then
rngDest(j, 2) = rngSource(i, 2)
rngDest(j, 3) = rngSource(i, 3)
rngDest(j, 4) = rngSource(i, 4)
j = j + 1
End If
Next i

End Sub



Mangesh
"Baffle, Atlanta, Ga" wrote in
message ...

I am very new to this.
I have a sheet - sheet 1 which has names in column b, c, d and if the

number
one is in column A on sheet one, I want it to pull the names in column

b,
c, d on sheet 1 to sheet 2 column b, c, d. If sheet 1 column a has z

zero
I want it to skip it and go to the next row with a number 1 in column A.

You
see, I only want the data on sheet 2 if I have a one in column 1. I want

it
to skip all records until it sees a One again in column a sheet one.

Please help