try this Sub Copy() Dim i As Integer Dim j As Integer 'find the next available cell to paste the data j = 2 Do While ThisWorkbook.Sheets(2).Range("B" & j) <> "" j = j + 1 Loop
'check whether the next cell is "X" and if yes then paste the value in next sheet i = 2 Do While ThisWorkbook.Sheets(1).Range("A" & i) <> "" If ThisWorkbook.Sheets(1).Range("Q" & i) = "X" Then ThisWorkbook.Sheets(2).Range("R" & j) = ThisWorkbook.Sheets (1).Range("A" & i) ThisWorkbook.Sheets(2).Range("S" & j) = ThisWorkbook.Sheets (1).Range("B" & i) j = j + 1 End If i = i + 1 Loop End Sub On Jun 16, 10:38 pm, Souriane <jsouri...@videotron.ca> wrote: > Hi! > > I need help with the an Excel macro. > > On my worksheet, I have a monthly calendar where we can enter > someone's working time. > > Beside it, starting on cell Q4, I have a 4 columns table that takes > the information from the calendar and make it ready to be transfer to > another worksheet where we will be able to "play" with the number. > > I want the macro to take the info in the table and transfer it in my > second worksheet as follow: > > 1. Check in column Q if there is an "X" or a "N/A" > 2. If "N/A", then nothing. (if empty also!) > 3. if "X" then the following: > 4. copy info in column R > 5. paste it in worksheet B, at the end of the existing table (that > range from column A to D), in column "B" > 6. copy info in column in column S > 7. paste *THE VALUE ONLY* in worksheet B in column "C" > > and the rest, I think I will be able to do it. > > This macro will teach me how to do other similar one because it covers > something that I often wish to do but can't yet. > > Thank you for your help! > > Souriane --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com or Ashish Jain @ 26may.1...@gmail.com ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---