Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Selection Address
XL2003
How can I use a selection address from sheet1 as a range on sheet 2? I want to select a range of cells on sheet1, then click on a command button and have the same range selected on sheet2 so I can run another procedure on that range. I have this code that works on a selection from the same sheet. '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''' Private Sub cmd1_Click() For Each c In Selection If c.Font.ColorIndex = 3 Then ms = ms + c Next For Each c In Selection If c.Interior.ColorIndex = 38 Then ms = ms * 2 Next For Each c In Selection If c.Interior.ColorIndex = 3 Then ms = ms * 3 Next MsgBox ms End Sub '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''' |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Selection Address
Hi,
Assume that (say) sheet 1 is the active sheet and you have a range of cells selected. This will loop through the same range of cells on sheet 2. Sheet 1 must remain the active sheet. Sub Sonic() For Each c In Sheets("Sheet2").Range(Selection.Address) MsgBox c.Value Next End Sub Mike "Gizmo" wrote: XL2003 How can I use a selection address from sheet1 as a range on sheet 2? I want to select a range of cells on sheet1, then click on a command button and have the same range selected on sheet2 so I can run another procedure on that range. I have this code that works on a selection from the same sheet. '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''' Private Sub cmd1_Click() For Each c In Selection If c.Font.ColorIndex = 3 Then ms = ms + c Next For Each c In Selection If c.Interior.ColorIndex = 38 Then ms = ms * 2 Next For Each c In Selection If c.Interior.ColorIndex = 3 Then ms = ms * 3 Next MsgBox ms End Sub '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''' |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code to send email to address within selection in Excel workbook | Excel Discussion (Misc queries) | |||
Copy Selection - Transpose Selection - Delete Selection | Excel Discussion (Misc queries) | |||
How do I avoid excel change absolute address to relative address | Excel Discussion (Misc queries) | |||
long address list, name-address-city, listed vertically, how do y. | Excel Discussion (Misc queries) | |||
How do I import Office address book to Outlook Express address bo. | Excel Discussion (Misc queries) |