![]() |
Copy Rows to Existing Worksheets
Hi,
I need to copy a number of rows from a master worksheet to existin worksheets within the same work book. Ideally i would like to check the values of one column and send tha row to the corresponding worksheet based on the result. e.g. check row 1 and if Value in Column H = Blue, send entire row to worksheet 'Blue'. repeat for all rows in master sheet. Hope i am making sense and that someone can help. thanks, Hamis -- Message posted from http://www.ExcelForum.com |
Copy Rows to Existing Worksheets
how about something like
Sub copyblue() For Each c In Range("e2:e22") If UCase(c) = "B" Then x = Sheets("sheet4").Cells(Rows.Count, "a") _ ..End(xlUp).Row + 1 c.EntireRow.Copy Sheets("Sheet4").Cells(x, "a") End If Next End Sub -- Don Guillett SalesAid Software "HamishM" wrote in message ... Hi, I need to copy a number of rows from a master worksheet to existing worksheets within the same work book. Ideally i would like to check the values of one column and send that row to the corresponding worksheet based on the result. e.g. check row 1 and if Value in Column H = Blue, send entire row to worksheet 'Blue'. repeat for all rows in master sheet. Hope i am making sense and that someone can help. thanks, Hamish --- Message posted from http://www.ExcelForum.com/ |
Copy Rows to Existing Worksheets
Thanks Don.
I'm quite new to VBA so could you explain what each of the lines ar doing and the variables? Appreciate your help Hamis -- Message posted from http://www.ExcelForum.com |
Copy Rows to Existing Worksheets
Macro is looking for cells that contain "b" or "B" in the range and copying
the row to next available row on sheet 4 in col A. The line with the space & underscore ( _ ) is a "continuation" character to make the line into one line. Sub copyblue() For Each c In Range("e2:e22") If UCase(c) = "B" Then x = Sheets("sheet4").Cells(Rows.Count, "a") _ ..End(xlUp).Row + 1 c.EntireRow.Copy Sheets("Sheet4").Cells(x, "a") End If Next End Sub -- Don Guillett SalesAid Software "HamishM" wrote in message ... Thanks Don. I'm quite new to VBA so could you explain what each of the lines are doing and the variables? Appreciate your help Hamish --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 03:34 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com