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

if "CHECK.REFI" is the name of a cell then how do I pass that to a sub please?

This doesn't work:
Call Q20_DUMPDATA_UF0_QCP("CHECK.REFI")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
....statements
end sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Syntax issue

HOLD THE PHONE... I forgot that each of the cell names has ".memory" as a
suffix. The code works.

"Brett" wrote:

if "CHECK.REFI" is the name of a cell then how do I pass that to a sub please?

This doesn't work:
Call Q20_DUMPDATA_UF0_QCP("CHECK.REFI")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
...statements
end sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Syntax issue

If you are passing the cell address ...that should be as a string like

Call Q20_DUMPDATA_UF0_QCP("A1")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
'...statements
End Sub

but it looks like you are trying to pass a named range

Call Q20_DUMPDATA_UF0_QCP(check.refi)

Sub Q20_DUMPDATA_UF0_QCP(stage as Range)
'...statements
End Sub


--
If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

if "CHECK.REFI" is the name of a cell then how do I pass that to a sub please?

This doesn't work:
Call Q20_DUMPDATA_UF0_QCP("CHECK.REFI")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
...statements
end sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Syntax issue

I suspect that F_LNCH is the sheet object name, not the sheet name. In my
code sample 1 below), and yours, this will raise the Variable Not Defined
error
so rename the object. However, if its the sheet name, then change the code
(sample 2)

sample 1
Option Explicit
Sub x()
Q20_DUMPDATA_UF0_QCP ("CHECK.REFI")
End Sub
Sub Q20_DUMPDATA_UF0_QCP(stage As String)
Dim rng As Range
Set rng = F_LNCH.Range(stage)
End Sub

sample 1
Option Explicit
Sub x()
Q20_DUMPDATA_UF0_QCP ("CHECK.REFI")
End Sub
Sub Q20_DUMPDATA_UF0_QCP(stage As String)
Dim rng As Range
Set rng = Worksheets("F_LNCH").Range(stage)
End Sub



"Brett" wrote in message
...
if "CHECK.REFI" is the name of a cell then how do I pass that to a sub
please?

This doesn't work:
Call Q20_DUMPDATA_UF0_QCP("CHECK.REFI")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
...statements
end sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Syntax issue

Thanks Jacob

"Jacob Skaria" wrote:

If you are passing the cell address ...that should be as a string like

Call Q20_DUMPDATA_UF0_QCP("A1")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
'...statements
End Sub

but it looks like you are trying to pass a named range

Call Q20_DUMPDATA_UF0_QCP(check.refi)

Sub Q20_DUMPDATA_UF0_QCP(stage as Range)
'...statements
End Sub


--
If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

if "CHECK.REFI" is the name of a cell then how do I pass that to a sub please?

This doesn't work:
Call Q20_DUMPDATA_UF0_QCP("CHECK.REFI")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
...statements
end sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Syntax issue

Thanks Patrick, sorry I couldn't reply earlier - the website was temporarily
unavailable more than it was spasmodically available. Brett

"Patrick Molloy" wrote:

I suspect that F_LNCH is the sheet object name, not the sheet name. In my
code sample 1 below), and yours, this will raise the Variable Not Defined
error
so rename the object. However, if its the sheet name, then change the code
(sample 2)

sample 1
Option Explicit
Sub x()
Q20_DUMPDATA_UF0_QCP ("CHECK.REFI")
End Sub
Sub Q20_DUMPDATA_UF0_QCP(stage As String)
Dim rng As Range
Set rng = F_LNCH.Range(stage)
End Sub

sample 1
Option Explicit
Sub x()
Q20_DUMPDATA_UF0_QCP ("CHECK.REFI")
End Sub
Sub Q20_DUMPDATA_UF0_QCP(stage As String)
Dim rng As Range
Set rng = Worksheets("F_LNCH").Range(stage)
End Sub



"Brett" wrote in message
...
if "CHECK.REFI" is the name of a cell then how do I pass that to a sub
please?

This doesn't work:
Call Q20_DUMPDATA_UF0_QCP("CHECK.REFI")

Sub Q20_DUMPDATA_UF0_QCP(stage)
Set rng = F_LNCH.Range(stage)
...statements
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
right syntax pls123 Excel Worksheet Functions 8 May 6th 10 05:18 AM
Why so much non-OOP syntax in VBA? [email protected] Excel Programming 4 April 28th 08 07:36 PM
Need help with If/Then Syntax Shani Excel Programming 3 June 5th 06 07:11 PM
syntax issue JT Excel Programming 1 May 5th 06 09:07 PM
Names.Add - Range Syntax Issue Arturo Excel Programming 4 April 22nd 05 04:04 PM


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