Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Check date and act on it

I have a set of data imported to my spreadsheet using a macro. One of
the fields in that set is a Date...

I want to compare the month of the date to a string and add the line of
data to another spreadsheet accordingly....

How can this be done?

regards,
ladyhawke

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Check date and act on it

Hi,

If I understand correctly your request, most probably conditionnal
formatting would provide you with what you are looking for ...

HTH
Cheers
Carim

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Check date and act on it

if lcase(format(cell,"mmmm")) = "february" then

--
Regards,
Tom Ogilvy


"ladyhawke" wrote:

I have a set of data imported to my spreadsheet using a macro. One of
the fields in that set is a Date...

I want to compare the month of the date to a string and add the line of
data to another spreadsheet accordingly....

How can this be done?

regards,
ladyhawke


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Check date and act on it

I need to pick up the month part of the date (should be easy) and the
select the spreadsheet to recieve the data some how...

The idea is the the sheets are named jan - feb - mar etc. and every
date found that fits into one of these months should be put in the
corresponding sheet...

need to check the year though if its next year it should be put in a
"parking sheet" to be copied into a new file...

does this make sense

regards,
Ladyhawke

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 510
Default Check date and act on it

Hi,

Believe you are looking for something like :

If Sheet.Name = Text(month(yourcell),"mmm") then
your code
End If

HTH
Cheers
Carim



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Check date and act on it

Dim sh as Worksheet
if year(cell) = 2006 then
set sh = Worksheets(format(cell,"mmm"))
else
set sh = worksheets("Parking")
End if

There is not "TEXT" function in VBA.

However, based on the OP's original response, I don't know if this is
helpful. Perhaps

http://www.rondebruin.nl/copy5.htm

--
Regards,
Tom Ogilvy


"Carim" wrote:

Hi,

Believe you are looking for something like :

If Sheet.Name = Text(month(yourcell),"mmm") then
your code
End If

HTH
Cheers
Carim


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Check date and act on it

Your code snippet worked fine, except I'm not getting the date from a
cell but from an object. I solved it easily thought so thx for helping
out all of you!

This got me quite a step further into the VBA world :oD

//ladyhawke

Tom Ogilvy skrev:

Dim sh as Worksheet
if year(cell) = 2006 then
set sh = Worksheets(format(cell,"mmm"))
else
set sh = worksheets("Parking")
End if

There is not "TEXT" function in VBA.

However, based on the OP's original response, I don't know if this is
helpful. Perhaps

http://www.rondebruin.nl/copy5.htm

--
Regards,
Tom Ogilvy


"Carim" wrote:

Hi,

Believe you are looking for something like :

If Sheet.Name = Text(month(yourcell),"mmm") then
your code
End If

HTH
Cheers
Carim



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
Check input is a date stumac Excel Discussion (Misc queries) 5 December 14th 06 03:28 PM
Check for current date in a row sd Excel Programming 1 March 9th 06 09:06 AM
Change text to date and check against date in cell RW Excel Programming 3 February 2nd 06 03:29 PM
Check for date Kjeldc Excel Programming 8 November 30th 05 03:21 AM
Check date Ben Excel Programming 2 December 21st 04 06:18 AM


All times are GMT +1. The time now is 01:15 AM.

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

About Us

"It's about Microsoft Excel"