define range

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Define a range

Define a range

resolvedResolved · High Priority · Version 2010

Verzhiniya has attended:
Excel VBA Introduction course

Define a range

Hi,

I would like to define range, which will have a variable row. The idea is that I would like to choose a range up to a specific date. Using match function, I can find the row number. However, I don't know how to use this variable number to define different range every time.

Best regards,
Verzhiniya

RE: Define a range

Hi Verzhiniya,

Thank you for the forum question.

You can store the row number in a variable.

RowNumber=worksheetfunction.match("the date","The range",0)

and then you can use the range object.

Range("A" & RowNumber, "D" & RowNumber).

We have variables on our Excel VBA Intermediate course. Variables are very important to create dynamic codes.

I hope this can point you in the right direction.



Kind regards

Jens Bonde
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 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:

Move to edge of data block

When data is held in a block, however large, use the Ctrl key with your cursors to move quickly to the far edge of the block. Works with all 4 direction keys.

View all Excel hints and tips


Server loaded in 0.06 secs.