D
DoctorV
I have a Microsoft Query that retieves data from an Access Query an
puts it into an Excel Worksheet named AllData starting at cell B2.
have a sub named FormatDates that formats various column
appropriately. What I need to do is add to this sub a procedur
starting at cell a2 going down to the last row of data and filling
number starting with 1 to howver many numbers of rows there are to thi
last row
Just like edit Fiil down when you have the number 1 and 2 highlighte
and you fill down the range to the last row of data.
Thanks Here is my sub below
Sub FormatDates()
Sheets(Array("AllData")).Select
Sheets("AllData").Activate
Columns("o:q").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.ShrinkToFit = True
.NumberFormat = "m/d/yyyy"
End With
Columns("r:r").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.ShrinkToFit = True
.NumberFormat = "m/yyyy"
End With
Sheets("AllData").Select
Range("A2").Select
'Sheets("MainForm").Select
'Selection.Sort Key1:=Range("N2"), Order1:=xlAscending
Header:=xlGuess, _
'OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Selection.Sort Key1:=Range("d2"), Order1:=xlAscending
Key2:=Range("c2") _
, Order2:=xlAscending, Key3:=Range("b2"), Order1:=xlAscending
Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=4
Columns("m:m").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=4
Columns("j:j").Select
Selection.EntireColumn.Hidden = True
Rows("1:1").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Selection.Rows.AutoFit
End Su
puts it into an Excel Worksheet named AllData starting at cell B2.
have a sub named FormatDates that formats various column
appropriately. What I need to do is add to this sub a procedur
starting at cell a2 going down to the last row of data and filling
number starting with 1 to howver many numbers of rows there are to thi
last row
Just like edit Fiil down when you have the number 1 and 2 highlighte
and you fill down the range to the last row of data.
Thanks Here is my sub below
Sub FormatDates()
Sheets(Array("AllData")).Select
Sheets("AllData").Activate
Columns("o:q").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.ShrinkToFit = True
.NumberFormat = "m/d/yyyy"
End With
Columns("r:r").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.ShrinkToFit = True
.NumberFormat = "m/yyyy"
End With
Sheets("AllData").Select
Range("A2").Select
'Sheets("MainForm").Select
'Selection.Sort Key1:=Range("N2"), Order1:=xlAscending
Header:=xlGuess, _
'OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Selection.Sort Key1:=Range("d2"), Order1:=xlAscending
Key2:=Range("c2") _
, Order2:=xlAscending, Key3:=Range("b2"), Order1:=xlAscending
Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom
ActiveWindow.SmallScroll ToRight:=4
Columns("m:m").Select
Selection.EntireColumn.Hidden = True
ActiveWindow.SmallScroll ToRight:=4
Columns("j:j").Select
Selection.EntireColumn.Hidden = True
Rows("1:1").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 8
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Cells.Select
Selection.Rows.AutoFit
End Su