Cant make this small thing work...can some1 pls check.. [using formula in vba]

pedie

Well-known Member
Joined
Apr 28, 2010
Messages
3,875
It errors...using formula in vba
<TABLE style="WIDTH: 50pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=67><COLGROUP><COL style="WIDTH: 50pt; mso-width-source: userset; mso-width-alt: 2450" width=67><TBODY><TR style="HEIGHT: 13.5pt" height=18><TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; BACKGROUND-COLOR: #953735; WIDTH: 50pt; HEIGHT: 13.5pt; BORDER-TOP: windowtext 0.5pt solid; BORDER-RIGHT: windowtext 0.5pt solid" class=xl65 height=18 width=67>#NAME?</TD></TR></TBODY></TABLE>
and formula displays this way...=RANK('i1','i1':'I22')

actual formula= "=RANK(I1,$I$1:$I$22)"

Code:
[FONT=Courier New]Dim lr as long[/FONT]
[FONT=Courier New]lr = Sheet4.Range("H" & Rows.Count).End(xlUp).Row[/FONT]
[FONT=Courier New]Sheet4.Activate[/FONT]
[FONT=Courier New]   Range("J1:J" & lr).FormulaR1C1 = "=RANK(I1,$I$1:$I$" & lr & ")"[/FONT]
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Sorry it was suppose to be this way i think...

Code:
[/FONT]
[FONT=Courier New]Range("J1:J" & lr).Formula = "=RANK(I1,$I$1:$I$" & lr & ")"

:)
 
Upvote 0
In R1C1

Code:
Range("J1:J" & lr).FormulaR1C1 = "=RANK(RC9,R1C9:R" & lr & "C9)"
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,595
Members
452,927
Latest member
whitfieldcraig

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top