This is a really basic question -
I want to use VBA to paste a string of text, which is an excel formula, into a cell.
For example, I wan to create a macro that pastes "=IF(AND(SUM(L94:O94)>0,D94=""),1,0)" into cell E30.
What is the syntax I should use?
Also, for questions like these is there a good syntax reference that anyone would recommend?
Thanks!
Andrew
Last edited by adr150; 03-11-2010 at 07:18 PM.
Hi Andrew,
You would use:
Code:Range("E30").Formula = "=IF(AND(SUM(L94:O94)>0,D94=""""),1,0)"
Hi Andrew,
Paul's shown an example of the syntax in this case, for other syntax questions, I recommend recording a macro ([alt + t + m + r]) of when you complete the actions manually & then reviewing the code in the VBE. This is probably the best way of learning syntax. Once you have the recorded code, you can highlight a word in the VBE & press [F1] to open up the Help files which will give you more info - you should be able to solve many/most of your syntax issues this way w/o even opening your browser
hth
Rob
Rob Brockett
Kiwi in the UK
Always learning & the best way to learn is to experience...
awesome, thanks!
I'm pleased we could help - thanks for the feedback & marking the thread as Solved
Rob
Rob Brockett
Kiwi in the UK
Always learning & the best way to learn is to experience...
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks