Hello,
I have a macro that uses the active cell to sort through data and fill the acceptable data into three new columns. I wanted to see if someone could help me create a button that prompts the user to select the active cell and then runs through my macro code. This would be very helpful in improving the functionality of my spreadsheet. I'm thinking of using a Msgbox to say something like Please pick the cell you would like to begin sorting. Then the user would be able to click the active cell and the macro would run. Could someone help me write this? I know very little about writing macros and could use your help. Here is my existing code:
Sub mypicker()
rownow=activecell.row
columnnow=activecolumn.column
newrow=9
newcolumn=1
mytime=0
While Cells(rownow,columnnow).Value <> ""
If Cells (rownow,columnnow).Value >18 or (rownow,columnnow).Value <=0 Then
mya=myb
Else
Cells(newrow,newcolumn).Value = mytime
Cells(newrow,newcolumn+1).Value = Cells(rownow,columnnow-1).Value
Cells(newrow,newcolumn+4).Value = Cells(rownow,column now).Value
newrow=newrow+1
End If
rownow=rownow+1
mytime=mytime+1
Wend
End Sub
I have a macro that uses the active cell to sort through data and fill the acceptable data into three new columns. I wanted to see if someone could help me create a button that prompts the user to select the active cell and then runs through my macro code. This would be very helpful in improving the functionality of my spreadsheet. I'm thinking of using a Msgbox to say something like Please pick the cell you would like to begin sorting. Then the user would be able to click the active cell and the macro would run. Could someone help me write this? I know very little about writing macros and could use your help. Here is my existing code:
Sub mypicker()
rownow=activecell.row
columnnow=activecolumn.column
newrow=9
newcolumn=1
mytime=0
While Cells(rownow,columnnow).Value <> ""
If Cells (rownow,columnnow).Value >18 or (rownow,columnnow).Value <=0 Then
mya=myb
Else
Cells(newrow,newcolumn).Value = mytime
Cells(newrow,newcolumn+1).Value = Cells(rownow,columnnow-1).Value
Cells(newrow,newcolumn+4).Value = Cells(rownow,column now).Value
newrow=newrow+1
End If
rownow=rownow+1
mytime=mytime+1
Wend
End Sub