View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Ryk Ryk is offline
external usenet poster
 
Posts: 36
Default macro help please


Well, I think that all works, gonna try it a few times. As I am new to
posting here and have not be explained the rules, if I have further
questions, should I just keep adding to this one or post a new one?
other question probably easy enough tho, i am using a row
highlighter....

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Const cnNUMCOLS As Long = 256
Const cnHIGHLIGHTCOLOR As Long = 36 'default lt. yellow
Static rOld As Range
Static nColorIndices(1 To cnNUMCOLS) As Long
Dim i As Long
If Not rOld Is Nothing Then 'Restore color indices
With rOld.Cells
If .Row = ActiveCell.Row Then Exit Sub 'same row, don't
restore
For i = 1 To cnNUMCOLS
.Item(i).Interior.ColorIndex = nColorIndices(i)
Next i
End With
End If
Set rOld = Cells(ActiveCell.Row, 1).Resize(1, cnNUMCOLS)
With rOld
For i = 1 To cnNUMCOLS
nColorIndices(i) = .Item(i).Interior.ColorIndex
Next i
.Interior.ColorIndex = cnHIGHLIGHTCOLOR
End With
End Sub

This works just fine, put I have made a copy macro and this interferes
with it a bit, Can i make buttons, that turn a macro on or off? If so
i'd just add the off part to existing... hmmmmmm, i'll add the copy
macro as well, just in case it can be added to shut off the macro while
it copies.

Sub copy1()
'
' copy1 Macro
' Macro recorded 8/22/2006 by ryk'
' Keyboard Shortcut: Ctrl+o
'
Range("A3:AX1006").Select
Selection.Copy
Sheets("Month One").Select
Range("A3").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteColumnWidths,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Month One").Select
Range("A1").Select
Selection.Copy
Sheets("Month One").Select
Range("A1").Select
ActiveSheet.Paste
Range("B6:B1006").SpecialCells(xlCellTypeBlanks).E ntireRow.Delete
Sheets("Suggestions").Select
Range("A5:Z1000").Select
Selection.Copy
Sheets("Suggested Changes").Select
Range("A1").Select
mycell = Cells(Rows.Count, "A").End(xlUp).Row + 1
Range("A" & mycell).Select
Selection.PasteSpecial Paste:=xlPasteFormats,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteColumnWidths,
Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Selection.Replace What:="", Replacement:="$$$$$",
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="$$$$$", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
mycell = Cells(Rows.Count, "A").End(xlUp).Row + 1
Range("A" & mycell).Select


End Sub

If I cannot do on/off for macro I can lose the highlighter, it just
helps because we spend alot of hours a week staring at this program
hehe. More important the copy works, as we remove all the formulas so
we can send out smaller sized files.

Dave, if you answer this, please enlighten me on posting politeness if
I am doing this wrong, as I have really gained alot and don't wish to
**** anyone off heheh.

Many thanks for what you have helped me with though, i hope you get
paid somehow to do this.

Dave