ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Entry of Incomplete Dates (https://www.excelbanter.com/excel-programming/294029-re-entry-incomplete-dates.html)

George B[_2_]

Entry of Incomplete Dates
 
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.

"Frank Kabel" wrote in message
...
Hi
you may post the relevant part of your code which you're currently
using for inserting the date fields

--
Regards
Frank Kabel
Frankfurt, Germany


George B wrote:
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?






All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com