finding cell given row

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum 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

resolvedResolved · 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

RE: Finding a cell in a given row

Many thanks Gary. We do have column A blank, but that's no problem as we will always then end up in column B, and can offset appropriately from there.

Thanks again

Steve

 

Training courses

 

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
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Changing Excel file and worksheet defaults

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

By opening, modifying and saving these templates you can change the default settings for all new files and/or all newly inserted sheets.

Use Book.xlt to make change to defaults for new workbooks; and Sheet.xlt to change defaults for sheets.

If you can't find either of these files on your computer, you can create and save them yourself.

You can do this simply by creating a new workbook with the setting you want to use as your defaults; then saving them with the appropriate name in the XLStart folder. If you are using Office 2003, this is usually found in C:\Program Files\Microsoft Office\Office11\XLStart.

View all Excel hints and tips


Server loaded in 0.08 secs.