Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
right syntax | Excel Worksheet Functions | |||
Why so much non-OOP syntax in VBA? | Excel Programming | |||
Need help with If/Then Syntax | Excel Programming | |||
syntax issue | Excel Programming | |||
Names.Add - Range Syntax Issue | Excel Programming |