View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Runnig a macro relative from a form control

Assuming forms buttons


Dim rng As Range

Select Case Application.Caller

Case "Button 1": Set rng = Range("C5:C8")

Case "Button 2": Set rng = Range("D5:D8")

Case "Button 3": Set rng = Range("E5:E8")

Case "Button 4": Set rng = Range("F5:F8")
End Select

'then work on rng

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Paul Jolley" wrote in message
...
My problem is how to link a form button to a cell and get that information
into a macro.

I have written a small practice macro to perform some matrix
multiplication
assuming I have pre-selected the answer cells. Next I managed to get the
macro to automatically use the cells below the current active cell for the
answer array. Now, what I really want to do is apply this macro by
selecting
a button above each array. The button has now information on where it is
in
the sheet. I would like to lock it in a cell, and be able to reference the
4
cell below it as a range in my macro.

Any ideas?