![]() |
check active cell column
How can I get Excel to check that the Active Cell is in a particular column
before executing a macro? |
check active cell column
Kim,
If ActiveCell.Column = 1 Then 'your code here End If If you want it to do the macro each time the user selects a cell in a certain column use a worksheet SelectionChange event. Enter this in the code module for the worksheet (by right-clicking the worksheet tab and choosing "View Code"): Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Column = 1 Then 'your code here End If End Sub hth, Doug "KimR.Hammel" wrote in message ... How can I get Excel to check that the Active Cell is in a particular column before executing a macro? |
check active cell column
Doug,
Thanks, I want it to check that the active cell is in, say, column CW. If yes, execute macro, else post a message box telling them where to select and exit on OK. Kim "Doug Glancy" wrote: Kim, If ActiveCell.Column = 1 Then 'your code here End If If you want it to do the macro each time the user selects a cell in a certain column use a worksheet SelectionChange event. Enter this in the code module for the worksheet (by right-clicking the worksheet tab and choosing "View Code"): Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Column = 1 Then 'your code here End If End Sub hth, Doug "KimR.Hammel" wrote in message ... How can I get Excel to check that the Active Cell is in a particular column before executing a macro? |
All times are GMT +1. The time now is 01:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com