What value it is having

I want to know what value

ConfigWS.Cells(Rows.Count, "C").End(xlUp).Row

is going to have, each time, when running the macro.
LVL 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael FowlerSolutions ConsultantCommented:
This will return the last used row number in column C

So if Column C has values in Cells C1, C2 & C3 only this call will return 3
Martin LissOlder than dirtCommented:
It will return the row number of the last non-blank row in column C of the worksheet that ConfigWS refers to.
HuaMin ChenProblem resolverAuthor Commented:
I try to get value of

ConfigWS.Cells(Rows.Count, "C").End(xlUp).Row

and see its value is 94.

this is the relevant worksheet,
it seems it is taking last 2nd value on Column D, but I expect it to retrieve the last value on Column D. what to adjust?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Martin LissOlder than dirtCommented:
If you want the last row in column C then try

lngLastRow = Range("C1048576").End(xlUp).Row

If you want the last row in column D then try

lngLastRow = Range("D1048576").End(xlUp).Row

In both cases lngLastRow is defined like this

Dim lngLastRow As Long
Michael FowlerSolutions ConsultantCommented:
From what you have posted the call would return 29 and so using this you could do something like

lastRow = ConfigWS.Cells(Rows.Count, "C").End(xlUp).Row
ColDLastEntry = ConfigWS.Range("D" & lastRow).value

Open in new window

Some assumptions here
The sheet in your screenshot is the sheet referenced by ConfigWS
There are no entries outside to scope of your screenshot

From what you are describing the problem is not in the call you have posted but elsewhere in the code. Any chance you could post the workbook for us to look at?
HuaMin ChenProblem resolverAuthor Commented:
I am not able to refer to this value


Using these

    Dim lastRow As Long
    lastRow = ConfigWS.Cells(Rows.Count, "C").End(xlUp).Row

Open in new window

I see this value

ConfigWS.Range("D" & lastRow).value

is zero.
Michael FowlerSolutions ConsultantCommented:
I can confirm that the examples posted by both myself and Martin will work as described and so the issue is elsewhere in the code, at a guess, with the reference ConfigWS.

To help further the best option is for you to post the workbook. If needed just replace any sensitive sections with dummy data

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.