Where can I get help on setting up interactive macros? I want to be able to input data to a macro or specify a particular range in another worksheet to get or paste data.
Macro's will just run to the end unless you pause them some way, so to this end they're not interactive, but, you can introduce input boxes along the way like thisJust for fun'code supplied by Simon Lloyd '22/07/2011 Microsoft Office Help Sub Macro1() Dim Rng As Range, MyCell As Range, oCell As Range Dim i As Long, iR As Long, IB As String i = 1 iR = 3 Set Rng = Range("A1:A10") For Each MyCell In Rng MyCell.Interior.ColorIndex = i If i = 3 Then IB = Application.InputBox("Enter a name", "Name Collection") MyCell = IB ElseIf i = 6 Then IB = Application.InputBox("Enter a Range like B1 or B2:C5", "Range Collection") For Each oCell In Range(IB) oCell.Interior.ColorIndex = iR iR = iR + 1 Next oCell End If i = i + 1 Next MyCell End Sub![]()
Not all forums are the same - seek and you shall find
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks