Do While and xlDown?

deathmastar0

New Member
Joined
May 30, 2012
Messages
1
I have a pretty big task in mind, and I'm stuck on a lot of parts. I've outlined it below:

1. search for a specific phrase in the spreadsheet (exact phrase, match entire cell contents). Store its index.

This is easy enough:
Code:
Cells.Find(What:="Vendor Terminal p/n", After:=ActiveCell, LookIn:= _        xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=True, SearchFormat:=False).Activate
index = activecell.row

2. Use a Do While loop to find the index of the last non-empty cell in the range (index to the end of the column). Call it index2.

This is the part that's giving me troubles; I'm pretty sure that I should use Do While and xlDown, but I'm not at all sure HOW to implement this. Anybody have suggestions? I appreciate it!

3. Use this range to select the items in the column between the first index and the second index, and then copy the data in this range to a new spreadsheet. Save this spreadsheet as 'doc1.xlsx.'

4. Repeat the process, except now APPEND the items in the range to doc1.xlsx.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top