LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Problem with date values

I'm trying to write a macro in Excel 2003. In this macro, I want to
use the date values of three different dates, but I'm not able to make
it work. The code below shows three different methods I've tried, but
they all just return 0. I have also tried using Double or Date instead
of Integer, but it turns out the same. When debugging this code, it
looks like the second range selection doesn't work. Any suggestions?

With ActiveSheet
.Range(.Cells(5, 9), Cells(7, 9)).Select
'...
Dim dateBefore As Integer
Dim dateSepTest As Integer
Dim dateAfter As Integer
dateBefore = .Range(.Cells(5, 1)).Value
dateSepTest = .Range(.Cells(6, 1)).Formula
.Range(.Cells(7, 1)).Select
dateAfter = Selection.Formula
MsgBox("dateBefore = " & dateBefore)
MsgBox("dateSepTest = " & dateSepTest)
MsgBox("dateAfter = " & dateAfter)
End With
 
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
Creating Intermediate Date Values - New Problem Jim Berglund[_2_] Excel Programming 2 April 30th 07 02:34 AM
Date Formula Problem - Leave date blank if Null Gayla Excel Worksheet Functions 5 April 24th 07 09:42 PM
How do I convert date values to non-date format e.g. 01-06-78? mikelenno Excel Discussion (Misc queries) 2 July 8th 05 08:51 PM
Date values Problem Subs Excel Programming 2 May 12th 05 03:46 PM
autofilter problem with date values Simon Sunke Excel Programming 0 April 4th 04 04:28 PM


All times are GMT +1. The time now is 11:12 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"