PC Review


Reply
Thread Tools Rate Thread

Copy cells from one sheet to another based on criteria

 
 
Nathalie
Guest
Posts: n/a
 
      22nd Dec 2008
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 With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      23rd Dec 2008
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 & "" & 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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count if based on criteria within cells on another sheet --Viewpoint Microsoft Excel Misc 1 21st Aug 2009 10:01 PM
Copy Cells Based on Criteria in VBA bugsyb6 Microsoft Excel Programming 3 4th Feb 2009 02:09 PM
Help: auto-copy entire rows from 1 sheet (based on cell criteria) to another sheet. bertbarndoor Microsoft Excel Programming 4 5th Oct 2007 04:00 PM
Copy rows to another sheet. Criteria = cells in column H is not em =?Utf-8?B?SGVucmlr?= Microsoft Excel Programming 0 10th May 2007 03:12 PM
Copy entire row to another sheet based on a criteria Brig Siton Microsoft Excel Misc 3 7th Aug 2006 09:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:18 AM.