Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hallo,
I have following problem. I would need to use the user values submitted via inputbox into the formula of the following type: ActiveCell.FormulaR1C1 = "='HIO - Exp'!R[-21]C-'HIO - Rev'!R[-26]C" I.e. in this case the parameter "HIO" should be submitted via inputbox. I have the following code which ends with error. Sub formula_input_test IntgInput = InputBox("Submit the segment name (abbrev.)") segment = IntgInput Range("A1").Select ActiveCell.FormulaR1C1 = "='& segment & - Exp & !R[-21]C - '& segment & - Rev & !R[-26]C" End Sub Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
s = InputBox("Submit the segment name (abbrev.)")
ActiveCell.FormulaR1C1 = "='" & s & " - Exp'!R[-21]C-'" & s & " - Rev'!R[-26]C" Demo['d from the immediate window: s = "HIO" ? "='" & s & " - Exp'!R[-21]C-'" & s & " - Rev'!R[-26]C" ='HIO - Exp'!R[-21]C-'HIO - Rev'!R[-26]C -- Regards, Tom Ogilvy "Petr" wrote in message om... Hallo, I have following problem. I would need to use the user values submitted via inputbox into the formula of the following type: ActiveCell.FormulaR1C1 = "='HIO - Exp'!R[-21]C-'HIO - Rev'!R[-26]C" I.e. in this case the parameter "HIO" should be submitted via inputbox. I have the following code which ends with error. Sub formula_input_test IntgInput = InputBox("Submit the segment name (abbrev.)") segment = IntgInput Range("A1").Select ActiveCell.FormulaR1C1 = "='& segment & - Exp & !R[-21]C - '& segment & - Rev & !R[-26]C" End Sub Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Or, fixing yours:
ActiveCell.FormulaR1C1 = "='" & segment & " - Exp & !R[-21]C - '" _ & segment & " - Rev & !R[-26]C" -- Regards, Tom Ogilvy "Petr" wrote in message om... Hallo, I have following problem. I would need to use the user values submitted via inputbox into the formula of the following type: ActiveCell.FormulaR1C1 = "='HIO - Exp'!R[-21]C-'HIO - Rev'!R[-26]C" I.e. in this case the parameter "HIO" should be submitted via inputbox. I have the following code which ends with error. Sub formula_input_test IntgInput = InputBox("Submit the segment name (abbrev.)") segment = IntgInput Range("A1").Select ActiveCell.FormulaR1C1 = "='& segment & - Exp & !R[-21]C - '& segment & - Rev & !R[-26]C" End Sub Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you're confused by your quotes !
Sub test() Dim segment As String Dim formula As String segment = "HIO" formula = "=" & Chr(39) & segment & " - Exp" & Chr(39) & "!R[-21]C - " _ & Chr(39) & segment & " - Rev" & Chr(39) & "!R[-26]C" selection.FormulaR1C1 = formula End Sub "Petr" wrote: Hallo, I have following problem. I would need to use the user values submitted via inputbox into the formula of the following type: ActiveCell.FormulaR1C1 = "='HIO - Exp'!R[-21]C-'HIO - Rev'!R[-26]C" I.e. in this case the parameter "HIO" should be submitted via inputbox. I have the following code which ends with error. Sub formula_input_test IntgInput = InputBox("Submit the segment name (abbrev.)") segment = IntgInput Range("A1").Select ActiveCell.FormulaR1C1 = "='& segment & - Exp & !R[-21]C - '& segment & - Rev & !R[-26]C" End Sub Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
ActiveCell.FormulaR1C1 = "='" & segment & " - Exp '!R[-21]C - '" _
& segment & " - Rev '!R[-26]C" "Tom Ogilvy" wrote: Or, fixing yours: ActiveCell.FormulaR1C1 = "='" & segment & " - Exp & !R[-21]C - '" _ & segment & " - Rev & !R[-26]C" -- Regards, Tom Ogilvy "Petr" wrote in message om... Hallo, I have following problem. I would need to use the user values submitted via inputbox into the formula of the following type: ActiveCell.FormulaR1C1 = "='HIO - Exp'!R[-21]C-'HIO - Rev'!R[-26]C" I.e. in this case the parameter "HIO" should be submitted via inputbox. I have the following code which ends with error. Sub formula_input_test IntgInput = InputBox("Submit the segment name (abbrev.)") segment = IntgInput Range("A1").Select ActiveCell.FormulaR1C1 = "='& segment & - Exp & !R[-21]C - '& segment & - Rev & !R[-26]C" End Sub Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Yep -Missed some of the Ampersands you put in - sorry
ActiveCell.FormulaR1C1 = "='" & segment & " - Exp & !R[-21]C - '" _ & segment & " - Rev & !R[-26]C" should be ActiveCell.FormulaR1C1 = "='" & segment & " - Exp'!R[-21]C - '" _ & segment & " - Rev'!R[-26]C" so I should always bench test it in the immediate window: segment = "HIO" ? "='" & segment & " - Exp'!R[-21]C - '" _ & segment & " - Rev'!R[-26]C" ='HIO - Exp'!R[-21]C - 'HIO - Rev'!R[-26]C -- Regards, Tom Ogilvy "Patrick Molloy" wrote in message ... ActiveCell.FormulaR1C1 = "='" & segment & " - Exp '!R[-21]C - '" _ & segment & " - Rev '!R[-26]C" "Tom Ogilvy" wrote: Or, fixing yours: ActiveCell.FormulaR1C1 = "='" & segment & " - Exp & !R[-21]C - '" _ & segment & " - Rev & !R[-26]C" -- Regards, Tom Ogilvy "Petr" wrote in message om... Hallo, I have following problem. I would need to use the user values submitted via inputbox into the formula of the following type: ActiveCell.FormulaR1C1 = "='HIO - Exp'!R[-21]C-'HIO - Rev'!R[-26]C" I.e. in this case the parameter "HIO" should be submitted via inputbox. I have the following code which ends with error. Sub formula_input_test IntgInput = InputBox("Submit the segment name (abbrev.)") segment = IntgInput Range("A1").Select ActiveCell.FormulaR1C1 = "='& segment & - Exp & !R[-21]C - '& segment & - Rev & !R[-26]C" End Sub Thanks a lot in advance for any suggestions. Best regards, Petr Duzbaba |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula to input value | Excel Discussion (Misc queries) | |||
formula numeric input | Excel Discussion (Misc queries) | |||
Relative input for formula | Excel Discussion (Misc queries) | |||
input box = formula bar | Excel Discussion (Misc queries) | |||
input box , msgbox, formula | Excel Programming |