FormulaR1C1 using variables

I want to do this but can't:

ActiveCell.FormulaR1C1 = "=MyFunction(R[variable]C[variable])"

What are my options?
0
Utf
4/21/2010 8:52:01 PM
excel.programming 6508 articles. 1 followers. Follow

3 Replies
5884 Views

Similar Articles

[PageSpeed] 33

Try something like

ActiveCell.FormulaR1C1 = _ 
	"=MyFunction(R" & CStr(variable) & "C" & CStr(variable) & ")"

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
	Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com




On Wed, 21 Apr 2010 13:52:01 -0700, Cheah
<Cheah@discussions.microsoft.com> wrote:

>I want to do this but can't:
>
>ActiveCell.FormulaR1C1 = "=MyFunction(R[variable]C[variable])"
>
>What are my options?
0
Chip
4/21/2010 9:27:21 PM
ActiveCell.FormulaR1C1 = "=MyFunction(R" & varR & "C" & varC & ")"

"Cheah" wrote:

> I want to do this but can't:
> 
> ActiveCell.FormulaR1C1 = "=MyFunction(R[variable]C[variable])"
> 
> What are my options?
0
Utf
4/21/2010 9:51:02 PM
Don't forget your []'s:

Dim Var1 as long
dim Var2 as long

var1 = 21
var2 = 23
ActiveCell.FormulaR1C1 = "=MyFunction(R[" & var1 & "]C[" & var2 & "])"





Cheah wrote:
> 
> I want to do this but can't:
> 
> ActiveCell.FormulaR1C1 = "=MyFunction(R[variable]C[variable])"
> 
> What are my options?

-- 

Dave Peterson
0
Dave
4/21/2010 11:24:26 PM
Reply:

Similar Artilces:

Which control should I use to display Unicode characters?
Hi, there, I want to show Unicode characters, such as Chinese and Arabic. Which control should I use? Could you please give me a bit of example code? Thanks a lot. Gary You do not need specific control to display Unicode strings. Normally, you would use SetWindowText function to set the control text. If you look in winuser.h file this 'function' #defined as SetWindowTextA or SetWindowTextW (depending on the type of the build). If you want to use Unicode text regardless of build type, specify SetWindowTextW explicitly. Note that you need to have appropriate fonts installed to a...

Using Matrix Items
Someone...want to tell me how or if I can default which item is first (selected) when a matrix item is scanned? Is there a way to set this up? -- Thank You Vince :) What are the dimensions you use? Rob "Vince" <Nagarra@yahoo.com.(donotspam)> wrote in message news:E001F1F0-3002-4E1B-8E75-8E62FC6EC01C@microsoft.com... > Someone...want to tell me how or if I can default which item is first > (selected) when a matrix item is scanned? Is there a way to set this up? > -- > Thank You > Vince :) Using Lot Matrix, what I have is a six pack of coke or a sin...

Saving graph when using =(RAND) #2
Aha, the goal of this is to see on the same chart, all of the different iterations from pressing F9. Ultimately, I'd like to see something like 500 different lines on the same chart. Is there a less manual way to accomplish this? :) -- deacs ------------------------------------------------------------------------ deacs's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2321 View this thread: http://www.excelforum.com/showthread.php?threadid=271282 ...

XP Look and Feel in Windows 2000 using ComCtrl32.dll
Hai I Want to have a XP Look and feel under windows2000 using VC++ and ComCtrl32.dll and does any one have any idea please help me as basically iam looking to develop a Skin Waiting for your reply suresh You will have to draw many of your own components. You could purchase a library like the one from www.codejock.com or www.dundas.com or or www.bcgsoft.com use something like this: These are for Office XP, but you'll get the idea. It's a ton of work: http://www.codeproject.com/miscctrl/officexp.asp Tom "suresh" <s...

How to use TRACE in my app?
I want to use TRACE macro in a w32 application but got "error C2065: 'TRACE' : undeclared identifier" error. Which file should I include? I can't find it in MSDN. Thanks L TRACE is a MFC macro defined as ::AfxTrace() in afx.h. If you want to use trace in a Win32 application, then take a look at the OutputDebugString() API. -- Cheers Check Abdoul [VC++ MVP] ----------------------------------- "Leo" <leovannys@msn.NOSPAM.com> wrote in message news:OqzXrMsvDHA.2072@TK2MSFTNGP10.phx.gbl... > I want to use TRACE macro in a w32 application but got ...

Deadlock using CoCreateInstance and AfxLoadLibrary
Hello, I have a simple test app that starts 5-10 threads and each thread executes the below function. I consistently see deadlocks when one thread is calling CoCreate call while another thread calls AfxLoadLibrary: void CTest_app_tx4ole::OnAction2() { AFX_MANAGE_STATE(AfxGetStaticModuleState()) CLSID clsId; CLSIDFromProgID((CComBSTR)"anyprogid", &clsId); CString sThread; sThread.Format("%d", GetCurrentThreadId()); for(int i(0); i<10000; ++i) { OutputDebugString((CString)"0 " + sThread + "\n"); HMODULE hLib = AfxLoadLibrary("c:\...

SQL Solution Needed
Below are 2 tables/queries: one is the source the other is the desired result. I scoured the newsgroups and my access books - seems like queries with subqueries and/or a possible a crosstab query on is in order. I'm stuck on how to get started though. Any help would be great. SOURCE TABLE OR QUERY ToolID CompanyName TicketDate DeliveryTicket RecievingTicket 1 Company 1 3/2/2009 No Yes 1 Company 2 3/3/2009 Yes No 1 Company 2 7/21/2009 No Yes 1 Company 2 7/28/2009 Yes No 1 Company 2 8/4/2009 No Yes 1 Company 3 9/1/2009 Yes No 2 Com...

File in use #2
Hi There We have a shared file that has a password to enter. The users have all ogged out bt the file is still showng that one of them is logged in and when it is accessed says "File in use" Any ideas how we clear this? Thanks Scott ...

How to make use of excel (2003) drop down box value in cell callculations
How can I make a cell function that would use the value selected by user from a drop box? pekka Just refer to the cell itself. For instance, if the DD is in H1, =H1*10 or =IF(H1="Y","red","blue") -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pekka Siiskonen" <pekka_news@yahoo.co.uk> wrote in message news:n9gZh.21$aS2.17@read3.inet.fi... > How can I make a cell function that would use the value selected by user > from a drop box? > > pekka > > I should have been more pr...

Unable to login using passport to MS Money 2005.
I reinstalled my OS. Previously I has Money 2004. With the new OS, I installed Money 2005 and opened my existing money file. I always get login failed. If I create a new money file, my passport works. Regards, Xavier ...

Letter merge using backend data
I am a newbie and need some help on how to program a command button to pull data from the database backend and merge it into a Word template. Can I do this? I used code I found on this website as a foundation. Private Sub ApptRemind_Click() Dim objWord As Object Dim objMergeDoc As Object On Error Resume Next Set objWord = GetObject(, "Word.Application") If Err.Number <> 0 Then Set objWord = CreateObject("Word.Application") End If Err.Clear objWord.Visible = True objWord.Activ...

How to use my Outlook
I use msn8 but I can not use my outlook mail. I keep getting an error message about my POP3 account. ...

use of integer in .FormulaR1C1
hello, I used integer A and B in formula such as ..FormulaR1C1 = "=R[" & -A & "]C*R[" & -B & "]C" and it works fine How can I use the same principle for the following: ..FormulaR1C1 = "=INDEX(RangeX,[" & A &"],MATCH(YearEnd,Years,0))" [" & A &"] does not seem to be recognised PS: it is important that I use .FormulaR1C1 as my user needs to see the formula used. Thanks a lot. -- caroline you are combining a string and a number which is giving you the issue try .FormulaR1C1 = "...

GPIO read/write on intel using DDK example : Genport
Hi All, I would like to control one of the 14 GPIO provided on the Poulsbo UW15w. and I would like to use the driver (Genport) provided in DDK. Do you know if this would work to set and clear GPIO. How do I get the Address of the Port i want to set. (gpdwrite . ...) is it set in the .inf Thanks regards Norrih On Feb 16, 12:41=A0am, Norrih <Nor...@discussions.microsoft.com> wrote: > Hi All, > > I would like to control one of the 14 GPIO provided on the Poulsbo UW15w. > and I would like to use the driver (Genport) provided in DDK. > > Do you...

Task assignment should be able to be used through Outlook
o When a task is assigned there is no ability to accept or decline the task. This functionality is available within Outlook but not in CRM. o At the moment If the outlook functionality is used then CRM and outlook become out of sync and CRM is not able to track the task and its progress. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based...

Using CImage
Hi, I Made a file containing multiple graphic files by reading .jpg files and writing it to 1 file. Now I want to load the graphics in CImage structures. CImage.Load can only take filenames an IStream*, but since I put all the images in 1 big file i can't use the first. I can't find a way to load them from an IStream. Can someone help me with that? What i Have is: //////// HGLOBAL hGlobal = GlobalAlloc(GMEM_FIXED, len); //len = the length of the jpg IStream* stream; CreateStreamOnHGlobal(hGlobal, true, &stream); file.Read(stream, len); //file is a CFile object pointing to the big...

Retrieve tables from web with variable URL
Hello, This URL http://www.bibf.be/ipc/tamenu.asp has a field "postcode", asking for a 4-digit entry and leading to the links of all members of that postal code when all other inputs are omitted. The visible URL in the URL bar , however , remains unchanged. I have a list in Excel with several postal codes e.g. 2200 2500 2222 3000 for which I want to retrieve the members tot list them up on a worksheet. I know enough VBA to do that if I only knew the key to build that postal code into the URL. Is there a way to do that? Thank you very much for any help. Herman ...

create a report using vba to select the names for the report
Hi, I need to create a report of selected Customers, I have gone as far as creating a string with customer names in it. Whats next? sample = Selected_Customer_Names= [ABC], [test], [New], [A New One] ...... and so on. Is this correct for the report and/or how do i open the report with the above only listed? -- Message posted via http://www.accessmonster.com On Wed, 28 Apr 2010 03:47:34 GMT, "trevorC via AccessMonster.com" <u44860@uwe> wrote: >Hi, >I need to create a report of selected Customers, I have gone as far as >creating a string with ...

Control using a Listbox
Hey, I have a form of records, and a listbox with all of the dates from said records. Anyone know a way to select one of the dates in the listbox and click a button to edit that record. I've tried findrecord and openform with that date as a filter but I always just get the first record shown. Also I have a report and was wondering if you knew how to make the selected record in the same listbox the last record displayed in the report, sort of like printing the week ending. Thanks The wizard doesn't build the criteria. You need to build it. Open the code module and provide a val...

deleting rows automatically using a maco or vba
I have a report that comes to me in Excel 2003. I need to remove the first 3 and last 3 rows. The report in between may vary on the number of rows however. It is basically a repetion I want to forgo. This assumes that col A is filled on the last row: Sub RowRemover() Dim n As Long Dim s As String n = Cells(Rows.Count, "A").End(xlUp).Row s = n - 2 & ":" & n Rows(s).Delete Rows("1:3").Delete End Sub -- Gary''s Student - gsnu201001 "outrigger" wrote: > I have a report that comes to me in Excel 2003. I need t...

Using Outlook with a VPN
Yesterday i set up a VPN so as to allow our employees to work from home, today one of the employees highlighted a problem with it though. When connected through the vpn, they are unable to access their Outlook emailand insted have to disconnect and then access through a normal dial-up. Any thoughts? Many Thanks Try this. When you get the VPN login screen, choose Properties. On the Options tab, check the box next to Include Windows logon Domain. That helped me. Bob >-----Original Message----- >Yesterday i set up a VPN so as to allow our employees to >work f...

Can the IFS kit be used freely?
Hello. I know the IFS kit is distributed as part of the WDK. Does it means the IFS kit can be used freely? Or, shoud it be purchased? If it should be purchased, where can I buy its license? Thanks. > I know the IFS kit is distributed as part of the WDK. > Does it means the IFS kit can be used freely? Yes. --=20 Maxim S. Shatskih Windows DDK MVP maxim@storagecraft.com http://www.storagecraft.com ...

ActiveCell.FormulaR1C1
I need help.... The following statement is being used in a do loop. ActiveCell.FormulaR1C1 = "=IF(" & TagNmeMe & "!R[" & Cnt1 & "]C[-1]="""",""""," & TagNmeMe & "!R[" & Cnt1 & "]C[-1])" What I need it to do is this: if(sheet1!A5="","",sheet1!a5) then 9 rows down paste this: if(sheet2!A5="","",sheet2!a5) Problem is when recording a macro the cnt1 changes from nothing to 9 then to 18 but the formula does not mimic what...

Using Outlook 2003 in Windows 7
I have a valid version of Outlook 2003 that I am using in Windows 7 that has been properly activated. However, every time I open it in Windows 7 I am asked to accept the Microsoft End User Agreement, which is annoying since I accept it every time (actually this happens every time I open an Office 2003 product). Is there someway to deactivate this request? Thx for the help. "Barry" <Barry@discussions.microsoft.com> wrote in message news:11F6EC50-7351-4B84-A7BC-4322115C9B88@microsoft.com... > I have a valid version of Outlook 2003 that I am using in Win...

error while using case statement
Hi, I have to modify an existing query as below existing logic: and table.location in (select city from tablename1 where col=col) New logic: Now if the column table.loction' is null then I have to use the below logic select tablename1 CITY from tablename1 , tablename2 where =stn_id and tablename1 .id =tablename2.id if the column table.loction' is not null then i use the existing logic, i.e. and table.location in (select city from tablename1 where col=col) How can I incorporate this in my query. I planned to use a case statement, but I am getting errors in th...