• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA for Moving sorted data to a date relevant column

JohnH

New Member
HI all,

First my thanks for reading, my knowledge is still growing with VBA, and I have hit a snag I'm hoping someone would be able to help me with:

Code:
Sub Moving _Data()
1. For Each cell In Range("B1:B1") ' Where to look for the date
2. If cell.Value = "6/1/2011" Then ' The date
3. Range("A4:N100").Select ' What is the range to copy
4. Selection.Copy ' Copy it
>>Sheets("Jun").Select ' Select the Sheet it applies to
1. Range("A1").Select ' Where to paste the data
2. ActiveSheet.Paste
3. Sheets("Template").Select ' Go back to the templete sheet
4. Range("A1").Select
5. Application.CutCopyMode = False ' Remove the copy mode
End Sub

I found this bit of code that seems to work well enough, I can see what is being done here, such as finding data relating to a date, then copy and pasting the comparable
data to its relevant/corresponding sheet.

I need a similar bit of coding, but I can't seem to see beyond the problem... some kind of, Test If!

I see this could be quite a simple bit of coding for my needs. The first four and final five lines of the code is fine,
but I need to be able to get the code to access one sheet "Template" find the date ("B1" [June-16]) and match that
date against a corresponding row ("B1:B12") in another sheet "Annual", find the matching date ("June-16" [B6]) and paste the
content below that date ("C6:C128").

Are you able to help?

Your time is appreciated,
John
 
Just to clear up the question a little more...

I have got pretty far in a project that I am working on, but have hit one small snag.

I can collect data in one sheet, harvest and then sort the data in to a new order within a "Transfer" Sheet.

>Bridging a gap!

I need to be able to get one small piece of code together that now accesses the "Transfer" sheet, finds the date ("B6" [June-16]) and matches, ((resulting values only which have be created from variables, or different formulas)), it against a corresponding one in another sheet "Annual" in row("B6:K6" [Jan-16:Dec-16]); the result would be;

Sub: lookup "Transfer"("B6")="Annual"("E6"), copy content "Transfer"("B9:B128"), paste "Annual"(E9:E128"). End

Your help would be greatly appreciated
 
Hi ,

Questions of the kind you are posting generally require the data layout to be available to the person who wishes to answer.

If you can upload your complete workbook , with the data and the code in it , there is a greater chance that you will get a solution.

Narayan
 
Back
Top