Thread: VBA Code Errors
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default VBA Code Errors

Either declare them as dates

Dim curdate As Date
Dim predate As Date

or use the Text property

curdate = Range("F18").Text
predate = Range("F17").Text


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"PaulW" wrote in message
...
Sub Button4_Click()

Sheets("Calculations").Select
Dim curdate As String
Dim predate As String
curdate = Range("F18").Value
predate = Range("F17").Value
Workbooks.Open Filename:= _
"S:\ New\New Business All.xls"
Range("C3").Select
ActiveCell.FormulaR1C1 = "predate"
Range("D3:G3").Select
ActiveCell.FormulaR1C1 = "curdate"

This is the beginning part of a macro, if I have " around predate and
curdate they show as those words, when I don't they get put as 0.

Currently the values of these are April in F18 (curdate) and March in F17
(predate)