Assign Macro to all yellow highlighted cells
Solved/Closed
Alby
-
4 Feb 2010 à 20:17
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 14 Mar 2010 à 09:08
rizvisa1 Posts 4478 Registration date Thursday 28 January 2010 Status Contributor Last seen 5 May 2022 - 14 Mar 2010 à 09:08
Related:
- The formula contained in the yellow highlighted cell (i39) is
- Yellow light on touchpad - Guide
- Excel cell color formula - Guide
- Logitech formula vibration feedback wheel driver - Download - Drivers
- Student position formula in excel ✓ - Excel Forum
- Number to words in excel formula - Guide
2 responses
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
5 Feb 2010 à 05:18
5 Feb 2010 à 05:18
are you saying that even though you want to copy the row but in the row you want only to copy those cells that were colored yellow ?
Albylo
Posts
1
Registration date
Thursday 4 February 2010
Status
Member
Last seen
6 February 2010
6 Feb 2010 à 05:24
6 Feb 2010 à 05:24
NO i want to assign the code above to "ALL YELLOW HIGHLIGHTED CELL IN THE WORKSHEET"
i know roughly that i need to start with something like this .....
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "ALL THE YELLOW CELL IN THE WORKSHEET" Then
Dim row As Single
row = ActiveCell.row
Selection.EntireRow.Insert
Rows(row - 1).Copy
Rows(row).Select
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteFormulas
Selection.SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0
Application.CutCopyMode = False
End Sub
I am also aware that this will slow down my worksheet abit .. and i just want to see how much slower it going make my work....
all help will be great appreciated ... thanks for replying risvisa1
i know roughly that i need to start with something like this .....
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "ALL THE YELLOW CELL IN THE WORKSHEET" Then
Dim row As Single
row = ActiveCell.row
Selection.EntireRow.Insert
Rows(row - 1).Copy
Rows(row).Select
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteFormulas
Selection.SpecialCells(xlCellTypeConstants).ClearContents
On Error GoTo 0
Application.CutCopyMode = False
End Sub
I am also aware that this will slow down my worksheet abit .. and i just want to see how much slower it going make my work....
all help will be great appreciated ... thanks for replying risvisa1
rizvisa1
Posts
4478
Registration date
Thursday 28 January 2010
Status
Contributor
Last seen
5 May 2022
766
14 Mar 2010 à 09:08
14 Mar 2010 à 09:08
Though I realize that it has been since some time you were looking for an approach. But still hopefully it will be of some use. I dont know if SelectionChange is the best method to be used. It will be triggered, as you select range of cell. But I guess you know better what you need to do.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
'If Target.Address = "ALL THE YELLOW CELL IN THE WORKSHEET" Then
For Each CELL In Target
If (CELL.Interior.Color = 65535) Then
Dim row As Single
row = ActiveCell.row
Selection.EntireRow.Insert
Rows(row - 1).Copy
Rows(row).Select
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteFormulas
Selection.SpecialCells(xlCellTypeConstants).ClearContents
Application.EnableEvents = True
On Error GoTo 0
End If
Next
Application.CutCopyMode = False
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
'If Target.Address = "ALL THE YELLOW CELL IN THE WORKSHEET" Then
For Each CELL In Target
If (CELL.Interior.Color = 65535) Then
Dim row As Single
row = ActiveCell.row
Selection.EntireRow.Insert
Rows(row - 1).Copy
Rows(row).Select
On Error Resume Next
Selection.PasteSpecial Paste:=xlPasteFormulas
Selection.SpecialCells(xlCellTypeConstants).ClearContents
Application.EnableEvents = True
On Error GoTo 0
End If
Next
Application.CutCopyMode = False
End Sub