Hi All
I am getting Type mismatch at the following line of code. ANy help would be much appreciated.
Thanks![]()
Please Login or Register to view this content.
Hi All
I am getting Type mismatch at the following line of code. ANy help would be much appreciated.
Thanks![]()
Please Login or Register to view this content.
M needs to be a number I believe,![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
(13 = the thirteenth column = Column M)
This function and others in VBA use R1C1 format, so R=ROW number, C=COLUMN number
![]()
Please Login or Register to view this content.
Edit: Same issue with
Try![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
ws.Cells(i, "Q").FormulaR1C1 = "=sum(" & ws.Cells(i, 26) / ws.Cells(i, 13) & ")"
Last edited by Speshul; 09-09-2014 at 11:40 AM.
You should hit F5, because chances are I've edited this post at least 5 times.
Example of Array Formulas
Click the * below on any post that helped you.
I have run the test and did not get any error
By the way
is the same as![]()
Please Login or Register to view this content.
But If ws.Cells(i, "M") <> 0 Then is more accurate as the column is hard coded.![]()
Please Login or Register to view this content.
I suspect the error might be found in ws
I was under the impression they need to be numeric.
Now I know!
Thanks.
That being the case,
ws.Cells: What is ws declared as? Isn't a mismatch usually a result of a variable being told to be something it can't be? (assigning a string to a variable defined as a boolean, for example)
Last edited by Speshul; 09-09-2014 at 11:46 AM.
If you do not use Option Explicit at the top , VBA might treat ws as unknown variable and might now now show you an error. If you use Option Explicit, however,the code will error, as the object ,which in this case is worksheet, has not been defined.
You need to use "set" with object variables.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks