Entry of Incomplete Dates

  • Thread starter Thread starter George B
  • Start date Start date
G

George B

I am attempting to extract data from a series of dated reports, using a
macro to insert data into various cells. Some of the data represent dates,
in the form 1-Nov or December 1. These appear to be correct when viewing
the worksheet, but I notice that the actual entry in the cell is for this
year, regardless of the year of the report. Is there any way to specify a
default year when the date is incomplete?
 
Hi
you may post the relevant part of your code which you're currently
using for inserting the date fields
 
Hi, Frank

The code is nothing special. The line of data being read:

Category;Nov 1;Nov 30;Change

line = myfile.readline
For j = 1 To 10000
k = InStr(line, ";")
If k > 0 Then
dat = Left(line, k - 1)
Cells(i, j).Value = dat
line = Right(line, Len(line) - k)
Else
Cells(i, j).Value = line
Exit For
End If
Next j

What happens: the data displays as "Nov 1", etc., but is actually stored as
being within the current year.
I was hoping I could specify a default year somehow which would apply in
this case. Otherwise, I suppose my only solution is to check every cell
which might contain a date for the year.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top