Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default macro using cell value

Hello,

I have an application called DPlot that can take commands from excel through
a macro.

I managed to pass information like so: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,-1)]"
DDETerminate Channel

End Sub
Sub UpElevation()
'
' UpElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,1)]"
DDETerminate Channel

End Sub
Sub LeftAzimuth()
'
' LeftAzimuth Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(-1,)]"
DDETerminate Channel

End Sub
Sub RightAzimuth()
'
' RightAzimuth Macro
' Macro recorded 24/03/2010

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(1,)]"
DDETerminate Channel

End Sub

At the moment I created 4 buttons, each of which have 1 of the above macros
assigned. This results in having to click repeatedly until I acheive the
disired result.

Now I'd like to make it moredynamic by substituiting the 1 and -1 values by
a cell value inside the same workbook but possibly different sheet. This cell
will be in turn controlled by a scroll bar inside excel that varies from -180
to 180.

My problem is that I cannot figure out the coding to refer to the cell and
how to use it inside each macro
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 63
Default macro using cell value

x = Worksheets("Sheet1").Range("A1").Value

www.stratatraining.co.uk

"Jason Falzon" wrote:

Hello,

I have an application called DPlot that can take commands from excel through
a macro.

I managed to pass information like so: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,-1)]"
DDETerminate Channel

End Sub
Sub UpElevation()
'
' UpElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,1)]"
DDETerminate Channel

End Sub
Sub LeftAzimuth()
'
' LeftAzimuth Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(-1,)]"
DDETerminate Channel

End Sub
Sub RightAzimuth()
'
' RightAzimuth Macro
' Macro recorded 24/03/2010

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(1,)]"
DDETerminate Channel

End Sub

At the moment I created 4 buttons, each of which have 1 of the above macros
assigned. This results in having to click repeatedly until I acheive the
disired result.

Now I'd like to make it moredynamic by substituiting the 1 and -1 values by
a cell value inside the same workbook but possibly different sheet. This cell
will be in turn controlled by a scroll bar inside excel that varies from -180
to 180.

My problem is that I cannot figure out the coding to refer to the cell and
how to use it inside each macro

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default macro using cell value

Thanks Andrea,

I replaced Sheet1 with the name of my sheet and put L1 instead of A1.

So now I have something like this: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
x = Worksheets("3D_Data").Range("L1").Value
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,x)]"
DDETerminate Channel

End Sub

I tried using x and x.Value but the same. I am missing something. Do I need
brackets inverted commas or something?

"Andrea Jones" wrote:

x = Worksheets("Sheet1").Range("A1").Value

www.stratatraining.co.uk

"Jason Falzon" wrote:

Hello,

I have an application called DPlot that can take commands from excel through
a macro.

I managed to pass information like so: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,-1)]"
DDETerminate Channel

End Sub
Sub UpElevation()
'
' UpElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,1)]"
DDETerminate Channel

End Sub
Sub LeftAzimuth()
'
' LeftAzimuth Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(-1,)]"
DDETerminate Channel

End Sub
Sub RightAzimuth()
'
' RightAzimuth Macro
' Macro recorded 24/03/2010

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(1,)]"
DDETerminate Channel

End Sub

At the moment I created 4 buttons, each of which have 1 of the above macros
assigned. This results in having to click repeatedly until I acheive the
disired result.

Now I'd like to make it moredynamic by substituiting the 1 and -1 values by
a cell value inside the same workbook but possibly different sheet. This cell
will be in turn controlled by a scroll bar inside excel that varies from -180
to 180.

My problem is that I cannot figure out the coding to refer to the cell and
how to use it inside each macro

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 457
Default macro using cell value

You need some additional quotation marks to seperate the text from a
variable.
x = Worksheets("3D_Data").Range("L1").Value
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(," & x & ")]"
DDETerminate Channel
--
Best Regards,

Luke M
"Jason Falzon" wrote in message
...
Thanks Andrea,

I replaced Sheet1 with the name of my sheet and put L1 instead of A1.

So now I have something like this: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
x = Worksheets("3D_Data").Range("L1").Value
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,x)]"
DDETerminate Channel

End Sub

I tried using x and x.Value but the same. I am missing something. Do I
need
brackets inverted commas or something?

"Andrea Jones" wrote:

x = Worksheets("Sheet1").Range("A1").Value

www.stratatraining.co.uk

"Jason Falzon" wrote:

Hello,

I have an application called DPlot that can take commands from excel
through
a macro.

I managed to pass information like so: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,-1)]"
DDETerminate Channel

End Sub
Sub UpElevation()
'
' UpElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,1)]"
DDETerminate Channel

End Sub
Sub LeftAzimuth()
'
' LeftAzimuth Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(-1,)]"
DDETerminate Channel

End Sub
Sub RightAzimuth()
'
' RightAzimuth Macro
' Macro recorded 24/03/2010

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(1,)]"
DDETerminate Channel

End Sub

At the moment I created 4 buttons, each of which have 1 of the above
macros
assigned. This results in having to click repeatedly until I acheive
the
disired result.

Now I'd like to make it moredynamic by substituiting the 1 and -1
values by
a cell value inside the same workbook but possibly different sheet.
This cell
will be in turn controlled by a scroll bar inside excel that varies
from -180
to 180.

My problem is that I cannot figure out the coding to refer to the cell
and
how to use it inside each macro



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 13
Default macro using cell value

Luke and Andrea thanks a million for your help.

Finally I found an acceptable solution with your help and some research.

I finaly used 2 scroll bars one for elevation and one for azimuth. Each
scroll bar controls 1 particular cell, but both have the same macro assigned.
So when I change scroll bar macro runs automatically taking the new values

coding: -


Sub ContourView()
'
' ContourView Macro
' Macro recorded 24/03/2010
'

'
x = Worksheets("3D_Data").Range("L1").Value
y = Worksheets("3D_Data").Range("L2").Value
Dim xNum As Long
xNum = 0
Do While xNum < 0
Loop

Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourView(" & y & "," & x & ")]"
DDETerminate Channel

End Sub

There might be better solutions but I am more then happy with this for now.

Cheers

Jason



"Luke M" wrote:

You need some additional quotation marks to seperate the text from a
variable.
x = Worksheets("3D_Data").Range("L1").Value
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(," & x & ")]"
DDETerminate Channel
--
Best Regards,

Luke M
"Jason Falzon" wrote in message
...
Thanks Andrea,

I replaced Sheet1 with the name of my sheet and put L1 instead of A1.

So now I have something like this: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
x = Worksheets("3D_Data").Range("L1").Value
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,x)]"
DDETerminate Channel

End Sub

I tried using x and x.Value but the same. I am missing something. Do I
need
brackets inverted commas or something?

"Andrea Jones" wrote:

x = Worksheets("Sheet1").Range("A1").Value

www.stratatraining.co.uk

"Jason Falzon" wrote:

Hello,

I have an application called DPlot that can take commands from excel
through
a macro.

I managed to pass information like so: -

Sub DownElevation()
'
' DownElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,-1)]"
DDETerminate Channel

End Sub
Sub UpElevation()
'
' UpElevation Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(,1)]"
DDETerminate Channel

End Sub
Sub LeftAzimuth()
'
' LeftAzimuth Macro
' Macro recorded 24/03/2010
'

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(-1,)]"
DDETerminate Channel

End Sub
Sub RightAzimuth()
'
' RightAzimuth Macro
' Macro recorded 24/03/2010

'
Channel = DDEInitiate("DPlot", "System")
DDEExecute Channel, "[ContourViewChange(1,)]"
DDETerminate Channel

End Sub

At the moment I created 4 buttons, each of which have 1 of the above
macros
assigned. This results in having to click repeatedly until I acheive
the
disired result.

Now I'd like to make it moredynamic by substituiting the 1 and -1
values by
a cell value inside the same workbook but possibly different sheet.
This cell
will be in turn controlled by a scroll bar inside excel that varies
from -180
to 180.

My problem is that I cannot figure out the coding to refer to the cell
and
how to use it inside each macro



.

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 transfer contents of 'Selected' cell to alternate cell. Gryndar Excel Worksheet Functions 7 December 20th 08 09:58 PM
'IF' Macro to insert cell contents to alternate cell if cell not e Gryndar Excel Worksheet Functions 6 December 20th 08 05:02 PM
Macro to Insert Current Date into cell - Macro to "Save As" Guy[_2_] Excel Worksheet Functions 4 December 12th 08 08:20 PM
macro to move part of cell contents to another cell icetoad hisself Excel Discussion (Misc queries) 4 November 27th 06 07:19 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM


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