Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this:
Private Sub CommandButton1_Click() Dim lngfindcells As Long 'Set counter up for Sheet1 Dim lngdestcount As Long 'Set counter up for destination cells inSheet2 Dim x As Long 'Set counter = 1 so destination values on Sheet2 begins at row 1 lngdestcount = 1 'Cycle through every cell in Sheet1 column A, starting at row 1 For lngfindcells = 1 To 10 If Worksheets("Master Questions").Cells(lngdestcount, 1) = "" Then 'Do Nothing Else 'If cell on Sheet1 has a value, copy it and paste it into Sheet2, beginning in column A, row 1 Worksheets("Master Questions").Range("B" & lngfindcells & ":B" & lngfindcells).Cells.Find("A").Offset(0, -1).Copy Destination:=Worksheets("Output").Range("A" & lngdestcount) 'Increment counter so next value copied will be belowprevious one on Sheet2 lngdestcount = lngdestcount + 1 End If Next End Sub Where Master questions has Column A with data Column B with A B or C in the cell as a value it outputs only the first cell in column B with the value "A" but doesnt move onto the next cell Any Ideas? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Loop to Find then Copy & Paste | Excel Discussion (Misc queries) | |||
Find Copy and Paste | New Users to Excel | |||
Find, copy and paste | Excel Discussion (Misc queries) | |||
Find, Copy, Paste to new row | Excel Programming |