![]() |
Conditional Lookup and copy loop between worksheets
Can anyone point me in the right direction to achieve the following
1 Workbook 2 Work sheets Sheet 1 A1 - Txt1 Title B1 - Txt2 Title C1 - Val1 Title A2A? - Txt1 TextString B2B? - Txt2 Textstring C2C? - Val1 (Null, 0,1 or 999) ? - min of 2, max unknown Sheet 2 Command button to do the following counter = 2 Loop until Sheet1-Ccounter = 999 Examine Sheet1-Ccounter If Sheet1-Ccounter = 1 then copy Sheet1-Acounter contents to Sheet2-Gcounter copy Sheet1-Bcounter contents to Sheet2-Hcounter counter = counter + 1 else counter = counter+1 Thank you |
Conditional Lookup and copy loop between worksheets
I wasn't exactly clear on what you wanted, but the
following should put you close. Merjet Private Sub CommandButton1_Click() Dim iCt1 As Integer Dim iCt2 As Integer iCt1 = 1 iCt2 = 1 Sheets("Sheet2").UsedRange.Clear Do iCt1 = iCt1 + 1 If Sheets("Sheet1").Cells(iCt1, 3) = 1 Then iCt2 = iCt2 + 1 Sheets("Sheet1").Range("A" & iCt2 & ":C" & iCt2).Copy _ Destination:=Sheets("Sheet2").Range("A" & iCt2) End If Loop Until Sheets("Sheet1").Cells(iCt1, 3) = "" End Sub |
All times are GMT +1. The time now is 03:39 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com