What value it is having

Hi,
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 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
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
0
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.
0
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,
14
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?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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
0
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?
0
HuaMin ChenProblem resolverAuthor Commented:
I am not able to refer to this value


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


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.
0
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
0

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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.