LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Typing vs VBA

In this particular case I don't know why the recorded macro did not work, I
can't recreate the setup to test.

It's not necessary first to assign the formula to a variable, it just makes
things easier. Recorded macros merely record the results of keystrokes,
including unnecessary select and activate. Generally it's better to adapt a
macro after recording it.

Regards,
Peter T


"JG" wrote in message
...
Ding ding! We have a winner. That worked.

Bonus question(s).... Why? Why can I key this, but not record it? Why
can't I enter this directly into the VBE...why do I have to assign it to a
variable first?

"Peter T" wrote:

OK I get the error you mentioned, start by rearranging like this -

Sub test()
Dim sFmla As String
Dim rCell As Range

Set rCell = Range("I2")

sFmla = "=IF(INDIRECT(""RC8"", FALSE)=""Auto No Run"",
IF(GETPIVOTDATA(""Comp Status"", TCCompositionAnalysis!$A$3, ""TC ID"",
INDIRECT(""RC1"", FALSE), ""Comp Status"", ""Error"", ""ManAuto"",
""Auto""), ""Auto Error"", IF(GETPIVOTDATA(""Comp Status"",
TCCompositionAnalysis!$A$3, ""TC ID"", INDIRECT(""RC1"", FALSE), ""Comp
Status"", ""UnDev"", ""ManAuto"", ""Auto"")0, ""Auto UnDev"",
IF(GETPIVOTDATA(""Comp Status"", TCCompositionAnalysis!$A$3, ""TC ID"",
INDIRECT(""RC1"", FALSE), ""Comp Status"", ""Maint"", ""ManAuto"",
""Auto"")0, ""Auto Maint"", ""Eval This Row""))), IF(INDIRECT(""RC8"",
FALSE)=""Run Auto"", """", """"))"

rCell.Formula = sFmla

End Sub


The formula is the same as yours though you'll probably need to unwrap
The main change is Formula vs your FormulaR1C1

That at least enables the formula to be entered though I have no idea if
it
will give the correct result, it's impossible for me to recreate your
workbook. At a glance though "RC8" & RC1 don't look right, would expect a
numeral after the R.

Notice there's no need to 'Select' the cell (you'd need to qualify it
further if it's not on the activesheet)

You didn't need Option Explicit as you didn't use any variables. But if
you
use them, as in my example, best to head the module with Option Explicit,
ie
include it at the top of the module.

Regards,
Peter T





 
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
Where has my typing bar gone? gramsiam65 Setting up and Configuration of Excel 3 April 7th 23 12:17 PM
Get #### when typing Bill Excel Discussion (Misc queries) 2 March 10th 10 08:26 PM
name typing Vicky Excel Worksheet Functions 2 April 20th 08 01:00 PM
Is there a better way (with less typing)? Don Guillett[_4_] Excel Programming 0 September 1st 04 10:30 PM
Is there a better way (with less typing)? Earl Kiosterud[_4_] Excel Programming 0 September 1st 04 10:27 PM


All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"