F
Flipper
Good Day
I process a data that is extracted from a loan system through a data mining
app. I do as much formatting in that app as I can before expoting to excel.
I'm trying to write a macro that will do all the formatting I need. I can
actually record the macro to do exactly what I want, EXCEPT, there are
multiple ranges of data, that may be there one day, but not the next.
I really have very limited exp. with macros, other than recording, and I
just don't have a clue how to do this. Here is a portion of the code:
Sub FINX_FORMAT()
'
' FINX_FORMAT Macro
'
'
Columns("K:K").Select
Selection.Cut
Columns("P").Select
ActiveSheet.Paste
Columns("K:K").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("H2"), Order1:=xlAscending, Key2:=Range("D2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.End(xlDown).Select
Range("J23:N23").Select
With Selection.Font
.Name = "Tahoma"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("K23").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-21]C:R[-1]C)"
Selection.AutoFill Destination:=Range("K23:N23"), Type:=xlFillDefault
Range("K23:N23").Select
Selection.End(xlToLeft).Select
I basically need to repeat this same steps over and over, again with the
understanding that the date will change from day to day.
I would so appreciate some assistance
I process a data that is extracted from a loan system through a data mining
app. I do as much formatting in that app as I can before expoting to excel.
I'm trying to write a macro that will do all the formatting I need. I can
actually record the macro to do exactly what I want, EXCEPT, there are
multiple ranges of data, that may be there one day, but not the next.
I really have very limited exp. with macros, other than recording, and I
just don't have a clue how to do this. Here is a portion of the code:
Sub FINX_FORMAT()
'
' FINX_FORMAT Macro
'
'
Columns("K:K").Select
Selection.Cut
Columns("P").Select
ActiveSheet.Paste
Columns("K:K").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
Selection.CurrentRegion.Select
Selection.Sort Key1:=Range("H2"), Order1:=xlAscending, Key2:=Range("D2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal
Range("A1").Select
Selection.End(xlDown).Select
Range("J23:N23").Select
With Selection.Font
.Name = "Tahoma"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
End With
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Range("K23").Select
ActiveCell.FormulaR1C1 = "=SUM(R[-21]C:R[-1]C)"
Selection.AutoFill Destination:=Range("K23:N23"), Type:=xlFillDefault
Range("K23:N23").Select
Selection.End(xlToLeft).Select
I basically need to repeat this same steps over and over, again with the
understanding that the date will change from day to day.
I would so appreciate some assistance