Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
LLr LLr is offline
external usenet poster
 
Posts: 3
Default Macro better solution than cell formula with date?

Hello,

I have a worksheet in which a cell formula is not the ideal solution and a
macro would seem the better answer. In the columns with the date I have a
formula which returns the current date plus days. Column A has values which
change daily. I need a macro that ideally would, if it was the current date
in the date columns, place the value of column A in the price cell for that
day and not change that value on subsequent days. There date/price columns
go through plus 20 days. Currently I have the formula =IF(TODAY()=B4,A4,0)
in cell C4, the problem with which it changes the value daily and I have not
come up with a cell formula that will place the value of A4 in C4 without
changing it daily. Thank you in advance for any solutions.

(Hope this formats properly in the post to the newsgroup)

Column A ColumnB ColumnC ColumnD ColumnE ColumnF
ColumnG


Plus 1 Day

Plus 2 Days

Plus 3 Days


Price
Date
Price
Date
Price
Date
Price

$6.46
04/08/05
$0.00
4/11/05
$0.00
4/12/05
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Macro better solution than cell formula with date?

You could try event code

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Range("B4:B23")) Is Nothing Then
With Target
If .Value = Date + .Row - 4 Then
.Offset(0, 1).Value = .Offset(0, -1).Value
Else
.Offset(0, 1).Value = 0
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--

HTH

RP
(remove nothere from the email address if mailing direct)


"LLr" wrote in message
...
Hello,

I have a worksheet in which a cell formula is not the ideal solution and a
macro would seem the better answer. In the columns with the date I have a
formula which returns the current date plus days. Column A has values

which
change daily. I need a macro that ideally would, if it was the current

date
in the date columns, place the value of column A in the price cell for

that
day and not change that value on subsequent days. There date/price columns
go through plus 20 days. Currently I have the formula =IF(TODAY()=B4,A4,0)
in cell C4, the problem with which it changes the value daily and I have

not
come up with a cell formula that will place the value of A4 in C4 without
changing it daily. Thank you in advance for any solutions.

(Hope this formats properly in the post to the newsgroup)

Column A ColumnB ColumnC ColumnD ColumnE

ColumnF
ColumnG


Plus 1 Day

Plus 2 Days

Plus 3 Days


Price
Date
Price
Date
Price
Date
Price

$6.46
04/08/05
$0.00
4/11/05
$0.00
4/12/05
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00

$0.00
01/02/00
$0.00
1/3/00
$0.00
1/4/00
$0.00





  #3   Report Post  
Posted to microsoft.public.excel.programming
LLr LLr is offline
external usenet poster
 
Posts: 3
Default Macro better solution than cell formula with date?

Thanks for the response! I will try that this weekend.


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
Macro or Formula to have a cell match the date on the tab. Cindy Excel Discussion (Misc queries) 4 September 30th 09 07:56 PM
hopefully a simple solution for Macro quesion hmz Excel Worksheet Functions 3 July 30th 09 08:00 PM
Possible Macro Solution To My Problem Robert Excel Discussion (Misc queries) 4 July 24th 09 12:03 AM
Need the formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date kakasay Excel Discussion (Misc queries) 1 January 22nd 07 12:31 PM
Need Formula or macro. If i enter today date in the cell (Row 1,Column 2) and on tab out, the column 1 cell should be filled with "corresponding Day" of the date kakasay Excel Discussion (Misc queries) 1 January 22nd 07 12:31 PM


All times are GMT +1. The time now is 06:22 PM.

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"