0

I am kinda new to VBA, so as I am finishing my code, I notice that it is getting slow, so I search for ways to make it a bit faster, and i stumble across this article:

https://www.soa.org/news-and-publications/newsletters/compact/2012/january/com-2012-iss42/excel-vba-speed-and-efficiency/

And in rule #3 it says that I should: [...] Minimize traffic between VBA and the worksheet [...] and change something like (the "Issue_Age" is an example variable from that website):

Attained_Age = Range("Issue_Age") + Duration

to:

Issue_Age = Range("Issue_Age")
Attained_Age = Issue_Age + Duration

so I tried doing this in my code:

Sub mysub()
    Obj_in_reform = range("Obj_in_reform")
    with Obj_in_reform
        .value = vbNullString
    end with
    'rest of the code with other Obj_in_reform usage
end sub

I though about doing this because just like the tip in that website said, I used the named range a lot, so if what the website says is true it should make the code faster.

However VBA acts as if the variable Obj_in_reform is not a range. And I cannot use any dot (something) (like Obj_in_reform.value for example) atributes...

I also tried to:

Dim Obj_in_reform as range

In order to see if it fixed things but it doesn't...

Is this just not viable?

0 Answers0