Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello
I need help as I am not confident in VB although I am keen to learn what I can. I would like to copy a range of cells from 2 columns ( which is A2 to B 32 or A2 to slightly less B 29 depending on how many days there are in the month ), based on another value within the same sheet ( sheet 1 to another sheet 2. The cells or the rows of cells in Columns A & B need to be copied if Column C = Y The rows in sheets 1 & 2 start at row 2 as I have a header in row 1. It is only one sheet to another and although sheet 1 will be almost the same range each time, sheet 2 will need to have each new set of values appended to the next available empty row. I appreciate your time and help. Mark |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A bit more information?
Will the source sheet only have the current months data? You say "based on another value within the same sheet " Does that refer to the month desired or the number of days in the month. Here is a simple macro Sub copymonth() Set ss = Sheets("checks") Set ds = Sheets("sheet4") slr = ss.Cells(Rows.Count, 1).End(xlUp).Row dlr = ds.Cells(Rows.Count, 1).End(xlUp).Row + 1 ss.Range(Cells(2, 1), Cells(slr, 2)).Copy ds.Cells(dlr, 1) ds.Columns.AutoFit End Sub On Oct 12, 6:57*am, ML wrote: Hello I need help as I am not confident in VB although I am keen to learn what I can. I would like to copy a range of cells from 2 columns ( which is A2 to B 32 or A2 to slightly less B 29 depending on how many days there are in the month ), based on another value within the same sheet ( sheet 1 to another sheet 2. The cells or the rows of cells in Columns A & B need to be copied if Column C = Y The rows in sheets 1 & 2 start at row 2 as I have a header in row 1. It is only one sheet to another and although sheet 1 will be almost the same range each time, sheet 2 will need to have each new set of values appended to the next available empty row. I appreciate your time and help. Mark |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use this instead
Sub copymonth() Set ss = Sheets("checks") Set ds = Sheets("sheet4") slr = ss.Cells(Rows.Count, 1).End(xlUp).Row dlr = ds.Cells(Rows.Count, 1).End(xlUp).Row + 1 ss.Cells(2, 1).Resize(slr, 2).Copy ds.Cells(dlr, 1) ds.Columns.AutoFit End Sub On Oct 12, 7:38*am, Don Guillett wrote: A bit more information? Will the source sheet only have the current months data? You say "based on another value within the same sheet " Does that refer to the month desired or the number of days in the month. Here is a simple macro Sub copymonth() Set ss = Sheets("checks") Set ds = Sheets("sheet4") slr = ss.Cells(Rows.Count, 1).End(xlUp).Row dlr = ds.Cells(Rows.Count, 1).End(xlUp).Row + 1 ss.Range(Cells(2, 1), Cells(slr, 2)).Copy ds.Cells(dlr, 1) ds.Columns.AutoFit End Sub On Oct 12, 6:57*am, ML wrote: Hello I need help as I am not confident in VB although I am keen to learn what I can. I would like to copy a range of cells from 2 columns ( which is A2 to B 32 or A2 to slightly less B 29 depending on how many days there are in the month ), based on another value within the same sheet ( sheet 1 to another sheet 2. The cells or the rows of cells in Columns A & B need to be copied if Column C = Y The rows in sheets 1 & 2 start at row 2 as I have a header in row 1. It is only one sheet to another and although sheet 1 will be almost the same range each time, sheet 2 will need to have each new set of values appended to the next available empty row. I appreciate your time and help. Mark |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Don
Thank you for your reply. Each row on the sheet 1 (source sheet) represents 1 day within a month ( 1st to 31st) Column A = Date, Column B = Score, and in Column C I put a value of Y. It will be the same source sheet each time and the same sheet 2 (target sheet). So if Column C has a Y, then I need it to filter and show only Y, then copy/append them to the target sheet. I hope this better explains for you and thank you for your time and help. Mark |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Oct 12, 7:01*pm, "ML" wrote:
Hello Don Thank you for your reply. Each row on the sheet 1 (source sheet) represents 1 day within a month ( 1st to 31st) *Column A = Date, Column B = Score, and in Column C I put a value of Y. It will be the same source sheet each time and the same sheet 2 (target sheet). So if Column C has a Y, then I need it to filter and show only Y, then copy/append them to the target sheet. I hope this better explains for you and thank you for your time and help. Mark Send your file with a complete explanation and before/after examples to dguillett1 @gmail.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 13/10/2011 11:01 PM, Don Guillett wrote:
On Oct 12, 7:01 pm, wrote: Hello Don Thank you for your reply. Each row on the sheet 1 (source sheet) represents 1 day within a month ( 1st to 31st) Column A = Date, Column B = Score, and in Column C I put a value of Y. It will be the same source sheet each time and the same sheet 2 (target sheet). So if Column C has a Y, then I need it to filter and show only Y, then copy/append them to the target sheet. I hope this better explains for you and thank you for your time and help. Mark Send your file with a complete explanation and before/after examples to dguillett1 @gmail.com Thank you for your offer Don. I decided not to worry about the VB side and am just going to do it manually as my work IT are not crazy about me macking around with VB. Thank you for your time. Mark. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
HELP!! Help needed for newbie please | Excel Discussion (Misc queries) | |||
HELP!! Help needed for newbie please | Excel Discussion (Misc queries) | |||
Real Newbie newbie question | New Users to Excel | |||
I'm a newbie, urgently help needed | Excel Programming | |||
Newbie VBA Help Needed! | Excel Programming |