Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default active a set of VBA code once the cell have data.

Dear all,

I am now setting up a simple label template for the junior, and already made
a drop down list through validation function within the range A1:C12.

Once if the user type something in the cell within the range , I want to
execute some VBA coding such as formatting , coping .....etc.

Where should I start to create the coding ? In
Worksheet_SelectionChange(ByVal Target As Range), or Worksheet_Change(ByVal
Target As Range)


Thanks all.





  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default active a set of VBA code once the cell have data.

Change event. Here is an outline of your code

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:C12")) Is Nothing Then
With Target
'do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--
HTH

Bob Phillips

"norika" wrote in message
...
Dear all,

I am now setting up a simple label template for the junior, and already

made
a drop down list through validation function within the range A1:C12.

Once if the user type something in the cell within the range , I want to
execute some VBA coding such as formatting , coping .....etc.

Where should I start to create the coding ? In
Worksheet_SelectionChange(ByVal Target As Range), or

Worksheet_Change(ByVal
Target As Range)


Thanks all.







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default active a set of VBA code once the cell have data.


SelectionChange is triggered when you select the cell, whereas change i
triggered when you change or enter something in a cell. I guess in you
case, change would be better.

Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=38000

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
Row select mode to highlight active row of active cell Bart Fay[_2_] Excel Discussion (Misc queries) 0 May 11th 10 09:34 PM
Creating an active timeline of data from cell input kcip Excel Worksheet Functions 0 April 6th 09 06:40 AM
How to Add Rows From Active Cell with in a XLL Code Sheraz Excel Worksheet Functions 0 August 8th 06 01:17 PM
Ho do I determine the Active Cell location of the data being sele. Hibbs Excel Programming 2 March 17th 05 09:19 PM
Load active cell data via a function Mike G - D.C. Excel Worksheet Functions 2 November 23rd 04 09:13 PM


All times are GMT +1. The time now is 09:04 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"