Modifying an Excel sort macro

Kathy Belvel

New Member
Joined
Nov 11, 2015
Messages
8
I hope someone can help me with a mismatch error I am getting in a sort routine that I have modified to by changing to R1C!. I needed to change the to r1c1 since the table being sorted changes form week to week causing several cell references to change. The error (Run-time error 13 - type mismatch) occurs on the following line of code (line 20 in the image below);

.SetRange Range(Cells(r2, c), Cells(r3, c2)).Select

Below is a screen shot of the subject section of code. I suspect I will get the same error on line 36 when that condition is met.

Thanks in advance,

Kathy

1698874119118.png
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try removing the
VBA Code:
 .Select

Also just for your info, on your Dim line every variable bar c2 is being declared as Variant not Integer
 
Upvote 0
Thanks. it worked. I'm really embarrassed, I should have caught that all by myself. I guess I was looking at it too long.

Kathy
 
Upvote 0

Forum statistics

Threads
1,215,135
Messages
6,123,238
Members
449,093
Latest member
Vincent Khandagale

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