Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How can i write TSR code

Hi,
How should I write my codes that can be getting executed automatically, like
the way that excel formulas are getting executed at the back ground? Thanks,
Afshin


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default How can i write TSR code

Afshin

Event code?

http://www.cpearson.com/excel/events.htm
http://www.mvps.org/dmcritchie/excel/event.htm

Write your code as a User Defined Function instead of a Sub()?

http://www.mvps.org/dmcritchie/excel/install.htm

Gord Dibben Excel MVP

On Mon, 27 Sep 2004 22:42:42 -0700, "A-Design"
wrote:

Hi,
How should I write my codes that can be getting executed automatically, like
the way that excel formulas are getting executed at the back ground? Thanks,
Afshin


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How can i write TSR code

Could you please tell me what do I need to add or remove to the following
codes in order to make them like a (Event code) ? Thanks
====================================
Sub check the number()

Worksheets("Sheet1").Activate
Dim X(1 To 20) As Integer

X3 = 3
X4 = 3

For X4 = 3 To 18
If Cells(17, 13) = Cells(X4, 1) Then
Cells(17, 14) = Cells(X4, 3)
End If

'If 18 < Cells(17, 13) < 4 Then
'Cells(17, 14) = "OUT OF RANGE"
'End If

Next X4

End Sub

================================================== ==========================
=
"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Afshin

Event code?

http://www.cpearson.com/excel/events.htm
http://www.mvps.org/dmcritchie/excel/event.htm

Write your code as a User Defined Function instead of a Sub()?

http://www.mvps.org/dmcritchie/excel/install.htm

Gord Dibben Excel MVP

On Mon, 27 Sep 2004 22:42:42 -0700, "A-Design"
wrote:

Hi,
How should I write my codes that can be getting executed automatically,

like
the way that excel formulas are getting executed at the back ground?

Thanks,
Afshin




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 863
Default How can i write TSR code

It's not what the code does, but where you put it. Event macros go in the
modules named ThisWorkbook, Sheet1, Sheet2, etc. VBA will generate the
appropriate SUB/END SUB pair depending on what you select from the list of
supported events.

On Tue, 28 Sep 2004 15:04:45 -0700, "A-Design"
wrote:

Could you please tell me what do I need to add or remove to the following
codes in order to make them like a (Event code) ? Thanks
====================================
Sub check the number()

Worksheets("Sheet1").Activate
Dim X(1 To 20) As Integer

X3 = 3
X4 = 3

For X4 = 3 To 18
If Cells(17, 13) = Cells(X4, 1) Then
Cells(17, 14) = Cells(X4, 3)
End If

'If 18 < Cells(17, 13) < 4 Then
'Cells(17, 14) = "OUT OF RANGE"
'End If

Next X4

End Sub

================================================= ===========================
=
"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Afshin

Event code?

http://www.cpearson.com/excel/events.htm
http://www.mvps.org/dmcritchie/excel/event.htm

Write your code as a User Defined Function instead of a Sub()?

http://www.mvps.org/dmcritchie/excel/install.htm

Gord Dibben Excel MVP

On Mon, 27 Sep 2004 22:42:42 -0700, "A-Design"
wrote:

Hi,
How should I write my codes that can be getting executed automatically,

like
the way that excel formulas are getting executed at the back ground?

Thanks,
Afshin




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How can i write TSR code

Ok, I have changed my codes as you can see below but it doesn't work ... ,I
am so new in VBA could you please tell me how I should write the codes ?
Thanks,

Afshin
========================================
Private Sub Worksheet_Calculate()

Dim X(1 To 20) As Integer

X3 = 3
X4 = 3

For X4 = 3 To 18

If Cells(17, 13) = Cells(X4, 1) Then
Cells(17, 14) = Cells(X4, 3)
End If

Next X4

End Sub
=========================================







"Myrna Larson" wrote in message
...
It's not what the code does, but where you put it. Event macros go in the
modules named ThisWorkbook, Sheet1, Sheet2, etc. VBA will generate the
appropriate SUB/END SUB pair depending on what you select from the list of
supported events.

On Tue, 28 Sep 2004 15:04:45 -0700, "A-Design"
wrote:

Could you please tell me what do I need to add or remove to the following
codes in order to make them like a (Event code) ? Thanks
====================================
Sub check the number()

Worksheets("Sheet1").Activate
Dim X(1 To 20) As Integer

X3 = 3
X4 = 3

For X4 = 3 To 18
If Cells(17, 13) = Cells(X4, 1) Then
Cells(17, 14) = Cells(X4, 3)
End If

'If 18 < Cells(17, 13) < 4 Then
'Cells(17, 14) = "OUT OF RANGE"
'End If

Next X4

End Sub


================================================= ==========================

=
=
"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Afshin

Event code?

http://www.cpearson.com/excel/events.htm
http://www.mvps.org/dmcritchie/excel/event.htm

Write your code as a User Defined Function instead of a Sub()?

http://www.mvps.org/dmcritchie/excel/install.htm

Gord Dibben Excel MVP

On Mon, 27 Sep 2004 22:42:42 -0700, "A-Design"


wrote:

Hi,
How should I write my codes that can be getting executed

automatically,
like
the way that excel formulas are getting executed at the back ground?

Thanks,
Afshin








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How can i write TSR code

I figured it out,Thank you.


"A-Design" wrote in message
...
Ok, I have changed my codes as you can see below but it doesn't work ...

,I
am so new in VBA could you please tell me how I should write the codes ?
Thanks,

Afshin
========================================
Private Sub Worksheet_Calculate()

Dim X(1 To 20) As Integer

X3 = 3
X4 = 3

For X4 = 3 To 18

If Cells(17, 13) = Cells(X4, 1) Then
Cells(17, 14) = Cells(X4, 3)
End If

Next X4

End Sub
=========================================







"Myrna Larson" wrote in message
...
It's not what the code does, but where you put it. Event macros go in

the
modules named ThisWorkbook, Sheet1, Sheet2, etc. VBA will generate the
appropriate SUB/END SUB pair depending on what you select from the list

of
supported events.

On Tue, 28 Sep 2004 15:04:45 -0700, "A-Design"
wrote:

Could you please tell me what do I need to add or remove to the

following
codes in order to make them like a (Event code) ? Thanks
====================================
Sub check the number()

Worksheets("Sheet1").Activate
Dim X(1 To 20) As Integer

X3 = 3
X4 = 3

For X4 = 3 To 18
If Cells(17, 13) = Cells(X4, 1) Then
Cells(17, 14) = Cells(X4, 3)
End If

'If 18 < Cells(17, 13) < 4 Then
'Cells(17, 14) = "OUT OF RANGE"
'End If

Next X4

End Sub



================================================= ==========================
=
=
"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Afshin

Event code?

http://www.cpearson.com/excel/events.htm
http://www.mvps.org/dmcritchie/excel/event.htm

Write your code as a User Defined Function instead of a Sub()?

http://www.mvps.org/dmcritchie/excel/install.htm

Gord Dibben Excel MVP

On Mon, 27 Sep 2004 22:42:42 -0700, "A-Design"


wrote:

Hi,
How should I write my codes that can be getting executed

automatically,
like
the way that excel formulas are getting executed at the back ground?
Thanks,
Afshin








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
could someone write me a VB code? thanks Morgan New Users to Excel 6 March 10th 10 01:20 PM
write macro code nishkrish Excel Worksheet Functions 0 April 2nd 09 09:17 PM
Macro to write code aftamath77 Excel Discussion (Misc queries) 3 October 8th 08 10:36 PM
Using VBA to Write VBA code SB Excel Programming 10 January 23rd 04 02:01 PM
Write new VBA code from within a MACRO Neil Bhandar[_2_] Excel Programming 1 January 8th 04 04:16 PM


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