98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Finding a cell in a given row
Finding a cell in a given row
Resolved · Low Priority · Version 2010
Steve has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course
Finding a cell in a given row
Can anyone tell me how to select a cell in a given column but on the currently active row, no matter where the active cell is? We are trying to run a dialogue box if the contents of the cell in a particular column are blank, but the user may begin from any point in the row.
I assume we need to move the active cell to column A from wherever it happens to be, then to offset to the column we need, but I'm not sure how to move to column A without knowing where the active cell is to begin with.
Hope that's clear!
Steve
RE: Finding a cell in a given row
Hi Steve
Thanks for getting in touch. You could do this a number of ways, but let's pursue your direction above. How do we get to column A? Assuming there are no blank cells to the left of the ActiveCell:
ActiveCell.End(xlToLeft).Offset(0, 1).Select
Will jump to the left of the data (I assume that's column A), then offset by 1 column. So the cursor will end up in column B. You can change the 1 for whichever column you need.
The xlToLeft instruction is like when you press CTRL left arrow on the keyboard. You can also do xlToRight, xlUp and xlDown.
Kind regards
Gary Fenn
Microsoft Office Specialist Trainer
Tel: 0207 987 3777
Best STL - https://www.stl-training.co.uk
98%+ recommend us
London's leader with UK wide delivery in Microsoft Office training and management training to global brands, FTSE 100, SME's and the public sector
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Changing Excel file and worksheet defaultsThe appearance of any new Excel files or any new worksheets that are inserted into a file are controlled by two template files, Book.xlt and Sheet.xlt. |