Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone tell me what the problem is with the following code?
Period = InputBox("Input invoice period, e.g. AUG-07", "Period") Sheets("ANNUAL MASTER").Select Range("D7").Select ActiveCell.FormulaR1C1 = "=Spreadsheet!R[-5]C[-3] &"" """ & Period When I run this in a Macro, I get a VB "Run-time error '1004': Application-defined or object-defined error". It doesn't seem to like the "& Period" portion at the end of the last line. If I take that piece out, it works fine. The code seems to conform to the syntax that I have seen in many other places, so I'm stumped. Any help would be greatly appreciated! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you have issues with your & and your quotes... Give this a try...
Period = InputBox("Input invoice period, e.g. AUG-07", "Period") Sheets("ANNUAL MASTER").Select Range("D7").Formula = "=Spreadsheet!A2 & " & " " & Period -- HTH... Jim Thomlinson "COV MarshallT" wrote: Can anyone tell me what the problem is with the following code? Period = InputBox("Input invoice period, e.g. AUG-07", "Period") Sheets("ANNUAL MASTER").Select Range("D7").Select ActiveCell.FormulaR1C1 = "=Spreadsheet!R[-5]C[-3] &"" """ & Period When I run this in a Macro, I get a VB "Run-time error '1004': Application-defined or object-defined error". It doesn't seem to like the "& Period" portion at the end of the last line. If I take that piece out, it works fine. The code seems to conform to the syntax that I have seen in many other places, so I'm stumped. Any help would be greatly appreciated! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Jim, that did the trick! Thanks very much for your quick help!
"Jim Thomlinson" wrote: you have issues with your & and your quotes... Give this a try... Period = InputBox("Input invoice period, e.g. AUG-07", "Period") Sheets("ANNUAL MASTER").Select Range("D7").Formula = "=Spreadsheet!A2 & " & " " & Period -- HTH... Jim Thomlinson "COV MarshallT" wrote: Can anyone tell me what the problem is with the following code? Period = InputBox("Input invoice period, e.g. AUG-07", "Period") Sheets("ANNUAL MASTER").Select Range("D7").Select ActiveCell.FormulaR1C1 = "=Spreadsheet!R[-5]C[-3] &"" """ & Period When I run this in a Macro, I get a VB "Run-time error '1004': Application-defined or object-defined error". It doesn't seem to like the "& Period" portion at the end of the last line. If I take that piece out, it works fine. The code seems to conform to the syntax that I have seen in many other places, so I'm stumped. Any help would be greatly appreciated! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Can anyone tell me what the problem is with the following code?
Period = InputBox("Input invoice period, e.g. AUG-07", "Period") Sheets("ANNUAL MASTER").Select Range("D7").Select ActiveCell.FormulaR1C1 = "=Spreadsheet!R[-5]C[-3] &"" """ & Period Assuming "Spreadsheet" reference is correct, try it this way... ActiveCell.FormulaR1C1 = "=Spreadsheet!R[-5]C[-3]&""" & " " & Period & """" The other possibility is to modify the Period assignment line like this.... Period = " " & InputBox("Input invoice period, e.g. AUG-07", "Period") and then use this for the last line... ActiveCell.FormulaR1C1 = "=Spreadsheet!R[-5]C[-3]&""" & Period & """" Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help needed with Inputbox problem | Excel Programming | |||
Help needed with Inputbox problem | Excel Programming | |||
Inputbox/Regression Problem | Excel Programming | |||
Inputbox/Regression Problem | Excel Programming | |||
Inputbox for Worksheet name - problem | Excel Programming |