ChuckDrago
Active Member
- Joined
- Sep 7, 2007
- Messages
- 470
- Office Version
- 2010
- Platform
- Windows
Hi everyone,
For an app under development, I need the user to:
1) Select a range of rows within a single column (say, A5:A15)
2) Color the background of the selected range.
3) Click on a button that opens a UserForm where the selected range is shown ( e.g. within a text box in the UDF, labeled Selected Range:) as "A5:A15" and its new color kept.
The active macro would then merge the cells within the range, write a certain label on it and save the workbook. Further workbook openings will show the range with the written words within and the color background changed.
In researching the web, I came across to this snippet:
<code>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
.Worksheet.Cells.FormatConditions.Delete
.FormatConditions.Add xlExpression, , "TRUE"
.FormatConditions(1).Interior.Color = vbYellow
End With
End Sub
</code>
The only thing this allows is to change the color, but it retains neither the selected range color nor its address when clicking the button calling the active macro.
I will appreciate immensely if a modification to above or an alternative code is suggested to attain the sequence of events mentioned above.
Thanks, as usual
Chuck
For an app under development, I need the user to:
1) Select a range of rows within a single column (say, A5:A15)
2) Color the background of the selected range.
3) Click on a button that opens a UserForm where the selected range is shown ( e.g. within a text box in the UDF, labeled Selected Range:) as "A5:A15" and its new color kept.
The active macro would then merge the cells within the range, write a certain label on it and save the workbook. Further workbook openings will show the range with the written words within and the color background changed.
In researching the web, I came across to this snippet:
<code>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
With Target
.Worksheet.Cells.FormatConditions.Delete
.FormatConditions.Add xlExpression, , "TRUE"
.FormatConditions(1).Interior.Color = vbYellow
End With
End Sub
</code>
The only thing this allows is to change the color, but it retains neither the selected range color nor its address when clicking the button calling the active macro.
I will appreciate immensely if a modification to above or an alternative code is suggested to attain the sequence of events mentioned above.
Thanks, as usual
Chuck