Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Copy a Range that matches Todays date Q

How could I code the following in order to copy the current days
column

I have dates specified in A1:G1 (one of which will be TODAY)
My data for these dates is in A5:G30

I am looking to copy the data who's date (in A1:G1) equals TODAY, to
cells Z1:Z25

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy a Range that matches Todays date Q

A bit more clarification on your layout
You could use a for/each loop
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sean" wrote in message
...
How could I code the following in order to copy the current days
column

I have dates specified in A1:G1 (one of which will be TODAY)
My data for these dates is in A5:G30

I am looking to copy the data who's date (in A1:G1) equals TODAY, to
cells Z1:Z25

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Copy a Range that matches Todays date Q

Don, layout looks like this

03/02/08 - 04/02/08 - 05/02/08 etc

134 - 762 - 323
32 - 209 - 1234
345 - 549 - 1862
etc - etc

I have a loop code that copies all columns, but above is more like a
lookup, in that if TODAY was 05/02/08 I would only want to copy the
range that shows 323; 1234; 1862 etc
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy a Range that matches Todays date Q

try
Sub copytodayscolumn()
mc = Rows(1).Find(Date).Column
'MsgBox mc
lr = Cells(Rows.Count, mc).End(xlUp).Row
'MsgBox lr
Range(Cells(2, mc), Cells(lr, mc)).Copy Range("z1")
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sean" wrote in message
...
Don, layout looks like this

03/02/08 - 04/02/08 - 05/02/08 etc

134 - 762 - 323
32 - 209 - 1234
345 - 549 - 1862
etc - etc

I have a loop code that copies all columns, but above is more like a
lookup, in that if TODAY was 05/02/08 I would only want to copy the
range that shows 323; 1234; 1862 etc


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 454
Default Copy a Range that matches Todays date Q

Don, thanks, two things on this

My dates are a formula eg. in cell B1is A1+1 etc etc, so the code
can't actually find a valid date. Also where is the 'paste' part in
the code, as I wish to have paste special values



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copy a Range that matches Todays date Q

If your date in a1 is a date then the b1 dates will also be dates so date
will be found.
Please try to FULLY state your problem when you post. You said COPY ("I am
looking to copy"), not paste values. Here is the modification.

Sub copytodayscolumn()
mc = Rows(1).Find(Date).Column
'MsgBox mc
lr = Cells(Rows.Count, mc).End(xlUp).Row
'MsgBox lr
'Range(Cells(2, mc), Cells(lr, mc)).Copy Range("z1")
Range(Cells(2, "z"), Cells(lr, "z")).Value = _
Range(Cells(2, mc), Cells(lr, mc)).Value
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Sean" wrote in message
...
Don, thanks, two things on this

My dates are a formula eg. in cell B1is A1+1 etc etc, so the code
can't actually find a valid date. Also where is the 'paste' part in
the code, as I wish to have paste special values


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
is there a formula that will subtract todays date from a hire date Heather Excel Worksheet Functions 5 April 25th 23 07:44 PM
How do I subtract todays date from range of dates AHD3 Excel Worksheet Functions 2 March 10th 10 09:30 PM
Exel increment date problem wrt todays date. [email protected] Excel Worksheet Functions 1 November 11th 07 06:58 PM
Create a button that will date stamp todays date in a cell Tom Meacham Excel Discussion (Misc queries) 3 January 11th 06 01:08 AM
When I open my past invoice it keeps changing date to todays date Stop date changing to todays in Excel Excel Worksheet Functions 2 October 7th 05 04:54 PM


All times are GMT +1. The time now is 04:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"