I am new to Excel VBA, but pretty okay with Access. Actually, it is because I am transferring the data from Excel to Access that I need to know this technique.
I am okay on making the changes themselves and have had success with that - forcing number formats, date formats, and text formats, but I would like to do more. When I transfer from Excel to Access, if there is a blank in a date field, I am using
Sub ChangeDateinblankDateColum
n()
Dim rngData As Range
Dim rngCell As Range
Set rngData = Range(Range("t2"), Range("t65536").End(xlUp))
For Each rngCell In rngData
If rngCell = "00/00/0000" Or rngCell = "" Then
rngCell = "01/01/1900"
End If
Next
.....
End sub
But I am repeating this for each of the columns that need this.
For the new "problem," blank number fields,
Set rngData = Range(Range("t2"), Range("t65536").End(xlUp))
For Each rngCell In rngData
If rngCell = "" Then
rngCell = "0"
End If
Next
Can that somehow be connected to these two sets of code?
Columns("c:c,e:e,m:m,n:n,u
:u,v:v,w:w
,y:y,z:z,a
a:aa,").Se
lect
Selection.NumberFormat = "0"
Columns("t:t,x:x,g:g,h:h,i
:i").Selec
t
Selection.NumberFormat = "m/d/yyyy"
TIA,
Susan
Start Free Trial