If .. Then

B

Bob

I'm trying to set up three coloumns called columns 1,2 and
3 that display names from another sheet "sheet 1" which
have the value 1 in any of or all of three different
columns. I want the names to appear in a list under the
column titles and this seems to be causing the problem.
Can anyone see what my problem is?

Thanks,

Bob

For i = 1 To 100
NextRow = Range("A1").Row + Range
("A1").CurrentRegion.Rows.Count
NextRow2 = Range("A2").Row + Range
("A2").CurrentRegion.Rows.Count
NextRow3 = Range("A3").Row + Range
("A3").CurrentRegion.Rows.Count
If Sheets("Sheet1").Range("A" & i).Value = 1 Then
Range("A1").Value = "Column 1": Cells(NextRow, 1) = Sheets
("Sheet1").Range("A" & i).Value
End If
If Sheets("Sheet1").Range("B" & i).Value = 1 Then
Range("B1").Value = "Column 2": Cells(NextRow2, 2) = Sheets
("Sheet1").Range("A" & i).Value
End If
If Sheets("Sheet1").Range("C" & i).Value = 1 Then
Range("C1").Value = "Column 3": Cells(NextRow3, 3) = Sheets
("Sheet1").Range("A" & i).Value
End If
Next i
 

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