Hi,
I tried setting up a simple macro by recording what i was doing. It is around football fixtures. Not all football leagues have games each day. I download the data in to excel then recorded the following macro below. I have a tab for each league at the bottom in the same workbook. This works fine when there are fixtures every day in all leagues.
The problem comes with the bold/italic Belgium First Division B wording. On this day there were no fixtures in this league but the macro is still looking for it/taking ages/and then saves the file as 875mb as opposed to 1mb. Is there any text I can put in to avoid this happening?
Thanks for any help!
Sub Macro3()
'
' Macro3 Macro
'
'
Selection.AutoFilter
Selection.End(xlToRight).Select
ActiveSheet.Range("$A$1:$LR$151").AutoFilter Field:=330, Criteria1:= _
"Australia A-League"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Next.Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Previous.Select
Range("LL168").Select
ActiveSheet.Range("$A$1:$LR$151").AutoFilter Field:=330, Criteria1:= _
"Belgium First Division B"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Belgium").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("A:E").Select
Columns("A:E").EntireColumn.AutoFit
Sheets("Australia").Select
Columns("A:E").Select
Columns("A:E").EntireColumn.AutoFit
Cells.Select
Sheets(Array("Australia", "Belgium")).Select
Sheets("Australia").Activate
With Selection.Font
.Name = "Browallia New"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Browallia New"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("A:A").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("E8").Select
Sheets("excel_tsd_2020-01-10").Select
Range("KS171").Select
End Sub
I tried setting up a simple macro by recording what i was doing. It is around football fixtures. Not all football leagues have games each day. I download the data in to excel then recorded the following macro below. I have a tab for each league at the bottom in the same workbook. This works fine when there are fixtures every day in all leagues.
The problem comes with the bold/italic Belgium First Division B wording. On this day there were no fixtures in this league but the macro is still looking for it/taking ages/and then saves the file as 875mb as opposed to 1mb. Is there any text I can put in to avoid this happening?
Thanks for any help!
Sub Macro3()
'
' Macro3 Macro
'
'
Selection.AutoFilter
Selection.End(xlToRight).Select
ActiveSheet.Range("$A$1:$LR$151").AutoFilter Field:=330, Criteria1:= _
"Australia A-League"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveSheet.Next.Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.Previous.Select
Range("LL168").Select
ActiveSheet.Range("$A$1:$LR$151").AutoFilter Field:=330, Criteria1:= _
"Belgium First Division B"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Belgium").Select
Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("A:E").Select
Columns("A:E").EntireColumn.AutoFit
Sheets("Australia").Select
Columns("A:E").Select
Columns("A:E").EntireColumn.AutoFit
Cells.Select
Sheets(Array("Australia", "Belgium")).Select
Sheets("Australia").Activate
With Selection.Font
.Name = "Browallia New"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Browallia New"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
Columns("A:A").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("E8").Select
Sheets("excel_tsd_2020-01-10").Select
Range("KS171").Select
End Sub