Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default macro restricted to one column

I have the following macro, but I would like to run only when a "w" is
entered in any cell in column A.
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Value = "w" Then
Range("I" & ActiveCell.Row).Select
End If
End Sub

Thanks in advance for the help!!!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 477
Default macro restricted to one column

In your Sheet module enter

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Application.Intersect(Range("A:A"), Target) Is Nothing Then
If Target.Value = "w" Then
Range("I" & Target.Row).Select
End If
End If
End Sub

"davemon" wrote:

I have the following macro, but I would like to run only when a "w" is
entered in any cell in column A.
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Value = "w" Then
Range("I" & ActiveCell.Row).Select
End If
End Sub

Thanks in advance for the help!!!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default macro restricted to one column

Thanks again......... Works Great!!!!!!!!!!!
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,316
Default macro restricted to one column

You need to change your if to the following condition:

If ActiveCell.Value = "w" And ActiveCell.Column = 1 Then

but you will have to turn MOVE SELECTION AFTER ENTER to off by clicking
TOOLS/OPTIONS, clicking the EDIT tab and turning off the checkbox.
--
Kevin Backmann


"davemon" wrote:

I have the following macro, but I would like to run only when a "w" is
entered in any cell in column A.
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Value = "w" Then
Range("I" & ActiveCell.Row).Select
End If
End Sub

Thanks in advance for the help!!!

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default macro restricted to one column

Private Sub Worksheet_Change(ByVal Target As Range)
if target.cells.count 1 then exit sub 'only one cell at a time
if intersect(target,me.range("a:a")) is nothing then exit sub

if lcase(target.value) = "w" then
me.cells(target.row,"I").select
end if
end sub



davemon wrote:

I have the following macro, but I would like to run only when a "w" is
entered in any cell in column A.
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Value = "w" Then
Range("I" & ActiveCell.Row).Select
End If
End Sub

Thanks in advance for the help!!!


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default macro restricted to one column

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value = "w" Then
Range("I" & n).Select
End If
End If
enditall:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Thu, 21 Sep 2006 08:26:02 -0700, davemon
wrote:

I have the following macro, but I would like to run only when a "w" is
entered in any cell in column A.
Private Sub Worksheet_Change(ByVal Target As Range)
If ActiveCell.Value = "w" Then
Range("I" & ActiveCell.Row).Select
End If
End Sub

Thanks in advance for the help!!!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to find text string in a column and paste data in another nicolascap Excel Discussion (Misc queries) 8 March 14th 06 03:13 PM
Return SEARCHED Column Number of Numeric Label and Value Sam via OfficeKB.com Excel Worksheet Functions 23 January 30th 06 06:16 PM
creating a bar graph Johnfli Excel Discussion (Misc queries) 0 October 26th 05 08:16 PM
Copy cell format to cell on another worksht and update automatical kevinm Excel Worksheet Functions 21 May 19th 05 11:07 AM
Return Count for LAST NonBlank Cell in each Row Sam via OfficeKB.com Excel Worksheet Functions 12 April 17th 05 10:36 PM


All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"