offset if statement

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Offset / if statement

Offset / if statement

resolvedResolved · Medium Priority · Version 2003

Richard has attended:
Excel VBA Intro Intermediate course

Offset / if statement

Hi, do you have an example of an offset function used in conjunction with an if statement, e.g if cell A1 contains 'Customer ABC Ltd' , then copy the cell containing 'Customer ABC Ltd' to one cell to the left of the copied cell and copy it down 6 rows, or six cells?

Hope im clear, thank you.

RE: Offset / if statement

Hi Richard

Attached you will find a Workbook with a list of names starting in cell "A1", that also contains a macro "CopyData".

Running this macro, which starts looking in cell "A1", it will copy the relevant cell 6 columns to the right if the cell contains the words "ABC Ltd"

The macro runs until it finds a blank cell in column A

Hope this helps

Carlos

Attached files...

Copy Using Offset.xls

RE: Offset / if statement

Cheers Carlos - much appreciated!

Richard.

 

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:

Remove unused toolbar buttons

Are there buttons on your Excel toolbars that you never use? Remove them from the toolbar by doing the following:

1. Go to Tools - Customise - Commands.
2. Select the toolbar button you wish to remove, then use your mouse to drag and drop the button into the Excel window. When you release your finger from the mouse, the button will disappear.

View all Excel hints and tips


Server loaded in 0.08 secs.