Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Naming Formulas

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I am trying to define my formulas so if I use a value for something else it makes easier to follow. But I can't get it it work. I was hoping to get some help.

Code:
'Today's Date Function
CurrentDate = Range("K" & LR - 3).Formula = "=" & "A" & LR - 4
Range("K" & LR - 3).Value = (CurrentDate)
Range("K" & LR - 3).Select
    With Selection
       .NumberFormat = "m/dd/yy"
   End With

What happens is in the appropriate Cell I get a 1/1/00 instead of the date that is in cell A & LR
 
You assign TRUE/FALSE to CurrentDate:
[!]CurrentDate = Formula1 = Formula2[/!]
and next format is as date in A & LR.

combo
 
You have 2 equals signs in the first row. CurrentDate will contain True or False (1 or 0) depending on whether
Range("K" & LR - 3).Formula
is equal to (the same as)
"=" & "A" & LR - 4

"K" & LR - 3
I think that this expression should return the cell address as a string (or a rangename as a cell). Concatenating a string ("K") with what is presumably a number (LR-3) might cause errors unless Excel is smart in interpreting your intent.
I assume that LR is an integer variable defined elsewhere in your code.




Gavin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top