Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default program activation

this program currently runs when the user is working
anywhere on the spreadsheet, but i only want the program
to run if the user enters something in range g251.
suggestions?

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Len(Range("h251")) 10 Then
Range("g251:h251").Borders(xlEdgeLeft).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeTop).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeBottom).Weight =
xlMedium: Range("g251").Interior.ColorIndex = 6
Else
Range("g251").Interior.ColorIndex = 0: Range
("g251").Borders(xlEdgeLeft).LineStyle = xlNone: Range
("g251").Borders(xlEdgeTop).LineStyle = xlNone: Range
("g251").Borders(xlEdgeBottom).LineStyle = xlNone
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default program activation

why not a worksheet_change instead
if target.address<"$G$251" then exit sub


"Lawson" wrote in message
...
this program currently runs when the user is working
anywhere on the spreadsheet, but i only want the program
to run if the user enters something in range g251.
suggestions?

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Len(Range("h251")) 10 Then
Range("g251:h251").Borders(xlEdgeLeft).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeTop).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeBottom).Weight =
xlMedium: Range("g251").Interior.ColorIndex = 6
Else
Range("g251").Interior.ColorIndex = 0: Range
("g251").Borders(xlEdgeLeft).LineStyle = xlNone: Range
("g251").Borders(xlEdgeTop).LineStyle = xlNone: Range
("g251").Borders(xlEdgeBottom).LineStyle = xlNone
End If
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default program activation

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$G$251" Then
If Len(Range("h251")) 10 Then
Range("g251:h251").Borders(xlEdgeLeft).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeTop).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeBottom).Weight =
xlMedium: Range("g251").Interior.ColorIndex = 6
Else
Range("g251").Interior.ColorIndex = 0: Range
("g251").Borders(xlEdgeLeft).LineStyle = xlNone: Range
("g251").Borders(xlEdgeTop).LineStyle = xlNone: Range
("g251").Borders(xlEdgeBottom).LineStyle = xlNone
End If
End If
End Sub


"Lawson" wrote in message
...
this program currently runs when the user is working
anywhere on the spreadsheet, but i only want the program
to run if the user enters something in range g251.
suggestions?

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
If Len(Range("h251")) 10 Then
Range("g251:h251").Borders(xlEdgeLeft).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeTop).Weight = xlMedium:
Range("g251:h251").Borders(xlEdgeBottom).Weight =
xlMedium: Range("g251").Interior.ColorIndex = 6
Else
Range("g251").Interior.ColorIndex = 0: Range
("g251").Borders(xlEdgeLeft).LineStyle = xlNone: Range
("g251").Borders(xlEdgeTop).LineStyle = xlNone: Range
("g251").Borders(xlEdgeBottom).LineStyle = xlNone
End If
End Sub



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
activation key LewisT Excel Discussion (Misc queries) 2 March 24th 10 05:27 AM
Activation Request Harry Excel Discussion (Misc queries) 2 September 15th 07 05:22 AM
Sheet activation CWillis Excel Discussion (Misc queries) 5 June 1st 06 09:50 PM
Ctl-X activation of macros John Baker Excel Programming 1 October 17th 03 09:24 PM
Excel macro activation. Pete McCosh[_3_] Excel Programming 0 July 29th 03 04:59 PM


All times are GMT +1. The time now is 02:57 AM.

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

About Us

"It's about Microsoft Excel"