fill a cell with this..

P

pls123

hi all i have to fill cell A20 with 'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$999
where 999 is the value of cell A20.
if u can describe the right syntax, that will help me a lot !! ty


Sub A22()
Dim aWB As Workbook
Dim aWS As Worksheet
Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

aWS.Range("A22") = "'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" &
aWS.Range("A20").Value
End Sub
 
D

Dave Peterson

You left out an equal sign.

I'd use:


aWS.Range("A22").formula _
= "='C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" & aWS.Range("A20").Value

Or maybe...

with aws.range("a22")
.numberformat = "General"
.formula = _
= "='C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" & aWS.Range("A20").Value
end with

(just in case A22 was formatted as Text.)

ps. I wouldn't use an address as the name of the macro, either.
hi all i have to fill cell A20 with 'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$999
where 999 is the value of cell A20.
if u can describe the right syntax, that will help me a lot !! ty


Sub A22()
Dim aWB As Workbook
Dim aWS As Worksheet
Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

aWS.Range("A22") = "'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" &
aWS.Range("A20").Value
End Sub
 
J

John Bundy

try this
aWS.Range("A22") = "='C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" &
aWS.Range("A20").Value
 
P

pls123

it doesn't work.
...but the = is shure correct :)

John Bundy said:
try this
aWS.Range("A22") = "='C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" &
aWS.Range("A20").Value
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


pls123 said:
hi all i have to fill cell A20 with 'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$999
where 999 is the value of cell A20.
if u can describe the right syntax, that will help me a lot !! ty


Sub A22()
Dim aWB As Workbook
Dim aWS As Worksheet
Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

aWS.Range("A22") = "'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" &
aWS.Range("A20").Value
End Sub
 
P

pls123

OOOO it works...
but the macro named A22 didn't work..dont'know why...
i changed the name and now its' ok !

pls123 said:
it doesn't work.
..but the = is shure correct :)

John Bundy said:
try this
aWS.Range("A22") = "='C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" &
aWS.Range("A20").Value
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


pls123 said:
hi all i have to fill cell A20 with 'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$999
where 999 is the value of cell A20.
if u can describe the right syntax, that will help me a lot !! ty


Sub A22()
Dim aWB As Workbook
Dim aWS As Worksheet
Set aWB = ThisWorkbook
Set aWS = aWB.Worksheets("Sheet1")

aWS.Range("A22") = "'C:\WB\[@@@@PILOT.xlsm]Sheet1'!$B$" &
aWS.Range("A20").Value
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

this should work.. 5
error 1004 6
launch macro in other workbook 3
range calculate 5
calling sub from other workbook 1
Switching sheets while timer running 0
timer issue 5
Compile Error: Invalid use of object 2

Top