Speeding up a macro

ldowling

New Member
Joined
Apr 20, 2018
Messages
7
Good morning All,
I am not in any way good at writing a new macro but i am "okay" at manipulating several macros to do what i want, i understand the simple side of macros but after frankensteining a macro together it seems to run horribly slow with certain changes to the code ...... surprise .... surprise .....

Code:
 Set rngSearch = ws.Columns(1).Find(What:=strWhat, LookIn:=xlValues)
with this line of code i use the
Code:
LookIn:=xlValues
and it does what i want but the problem is its very very slow and when i use
Code:
LookIn:=xlFormulas
its fast but it looks in a formula which i obviously don't want ... i want to find the value created by that formula.

My question to you great people is how can i make this faster ?

i cant share the workbook but i can provide the full macro if needed.

Thank you in advance people :)
 
Re: Macro Help - Speeding up a macro

I don't know how to make that specific line faster and without a better understanding of your workbook, difficult to suggest other changes.

You could try disabling calculations (Formula->Calculation->Manual) and then run my macro again but without your workbook, it's just guess work.
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Re: Macro Help - Speeding up a macro

Hello Jack,
Thank you for your help.

i have sorted the formula out, basically i am copying the column a (A28:A5000) to another column as text and using that as a reference to check.
So not really sorting, just working around the problem :)

This is alot faster and will be more then quick enough to use.

again, thank you

Kind Regards,
Luke Dowling
 
Upvote 0
Re: Macro Help - Speeding up a macro

using "xlValues" works but it just takes sooooo longg.

1) Do you need to use xlValues? Could you use xlFormulas instead? Here is a good discussion:

https://www.mrexcel.com/forum/excel...nce-between-find-look-values-vs-formulas.html

2) Have you tried limiting Find to only the cells in the column that are not empty? In other words:

Instead of using this
Code:
'Search Column 1
Set rngSearch = ws.Columns(1).Find(What:=strWhat, LookIn:=xlValues)
Use this
Code:
'Search Column 1
Set rngSearch = ws.Range("A1:A" & ws.Range("A" & ws.Rows.Count).End(xlUp).Row).Find(What:=strWhat, LookIn:=xlValues)
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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