Drewbert34
New Member
- Joined
- Jun 21, 2011
- Messages
- 26
I'm pretty new at VBA coding and verbiage so I hope I'm describing this so that it is understood by those more familiar with this than I.
I have this VBA coding that will date stamp column B if any changes are made in the range.
"Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
For Each cell In Target
If Not Intersect(cell, Range("A:BV")) Is Nothing Then
If cell <> "" Then
Application.EnableEvents = False
Range("B" & cell.Row) = Date
Application.EnableEvents = True
End If
End If
Next cell
End Sub"
Then I have 2 Macros that I need to run every Friday to format my workbook to remove Green highlighting and Bold font as well as devalue vlookups and certain formulas from my sheet.
"Sub RemoveGreenBold1()
'
' RemoveGreenBold1 Macro
'
'
Range("A7:BV7", Range("A7:BV7").End(xlDown)).Select
Selection.Font.Bold = False
ActiveSheet.Range("$A$6:$BV$313").AutoFilter Field:=1, Criteria1:=RGB(191, _
191, 191), Operator:=xlFilterCellColor
Range("B7:BV7", Range("B7:BV7").End(xlDown)).Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$6:$BV$456").AutoFilter Field:=1
End Sub"
and...
"Sub CopyPasteSpecial1()
'
' CopyPasteSpecial1 Macro
'
' Keyboard Shortcut: Ctrl+y
'
ActiveSheet.Range("$A$6:$BU$456").AutoFilter Field:=1, Criteria1:="<>"
Range("D7:F7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("H7:Z7").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-453
Range("I7:Z7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("AM7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("AP7:AT7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("AV7:AW7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("BD7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("BM7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Range("$A$6:$BU$620").AutoFilter Field:=1
ActiveWindow.SmallScroll Down:=-15
ActiveSheet.Shapes("Button 1").Visible = False
ActiveSheet.Shapes("Button 2").Visible = False
Range("a2") = Sheet1.Range("a2") + 7
End Sub"
The issue is that when the 2 Macros run they cause the VBA object to change the date in column B. How do I tell the Macros to diable the VBA object only while running the Macros?
I have this VBA coding that will date stamp column B if any changes are made in the range.
"Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
For Each cell In Target
If Not Intersect(cell, Range("A:BV")) Is Nothing Then
If cell <> "" Then
Application.EnableEvents = False
Range("B" & cell.Row) = Date
Application.EnableEvents = True
End If
End If
Next cell
End Sub"
Then I have 2 Macros that I need to run every Friday to format my workbook to remove Green highlighting and Bold font as well as devalue vlookups and certain formulas from my sheet.
"Sub RemoveGreenBold1()
'
' RemoveGreenBold1 Macro
'
'
Range("A7:BV7", Range("A7:BV7").End(xlDown)).Select
Selection.Font.Bold = False
ActiveSheet.Range("$A$6:$BV$313").AutoFilter Field:=1, Criteria1:=RGB(191, _
191, 191), Operator:=xlFilterCellColor
Range("B7:BV7", Range("B7:BV7").End(xlDown)).Select
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveSheet.Range("$A$6:$BV$456").AutoFilter Field:=1
End Sub"
and...
"Sub CopyPasteSpecial1()
'
' CopyPasteSpecial1 Macro
'
' Keyboard Shortcut: Ctrl+y
'
ActiveSheet.Range("$A$6:$BU$456").AutoFilter Field:=1, Criteria1:="<>"
Range("D7:F7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("H7:Z7").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=-453
Range("I7:Z7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("AM7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("AP7:AT7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("AV7:AW7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("BD7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("BM7").Select
Range(Selection, Selection.End(xlDown)).Select
Application.CutCopyMode = False
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
ActiveSheet.Range("$A$6:$BU$620").AutoFilter Field:=1
ActiveWindow.SmallScroll Down:=-15
ActiveSheet.Shapes("Button 1").Visible = False
ActiveSheet.Shapes("Button 2").Visible = False
Range("a2") = Sheet1.Range("a2") + 7
End Sub"
The issue is that when the 2 Macros run they cause the VBA object to change the date in column B. How do I tell the Macros to diable the VBA object only while running the Macros?