Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have accounting information on a sheet. One column is the account, the next one is the date of the movement, the next one is the amount, the last one is the comment. I would like to copy to another sheet the cells with the amount and the comment for one specified acount and dates included in one month. Do you have some code for this? I need help. thanks Nathalie |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You might have to change the sheet references to the actual sheet names, but
the code tested OK based on what you described. I suggest you test it on a copy of the file before you install it for permanent use in the actual file. Sub tract() Dim lr As Long, c As Range, acctVar As Variant lr = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row Set srcRng = ActiveSheet.Range("A2:A" & lr) acctVar = InputBox("Enter the account number to search.") For Each c In srcRng If c.Value = CLng(acctVar) Then Range("A" & c.Row & ":D" & c.Row).Copy _ Sheets(2).Range("A" & Sheets(2).Range("A65536"). _ End(xlUp).Row + 1) End If Next End Sub "Nathalie" wrote: Hi, I have accounting information on a sheet. One column is the account, the next one is the date of the movement, the next one is the amount, the last one is the comment. I would like to copy to another sheet the cells with the amount and the comment for one specified acount and dates included in one month. Do you have some code for this? I need help. thanks Nathalie |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count if based on criteria within cells on another sheet | Excel Discussion (Misc queries) | |||
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. | Excel Programming | |||
Copy certain cells in a row to another sheet, based on certain val | Excel Worksheet Functions | |||
Copy rows to another sheet. Criteria = cells in column H is not em | Excel Programming | |||
Copy entire row to another sheet based on a criteria | Excel Discussion (Misc queries) |