Selection routine

Savagefool

New Member
Joined
Aug 20, 2015
Messages
7
SO I have a table like this:

Assume Tidal Time is column A, Tidal height column B

Tidal Time
Tidal Height
00:00:00
01:00:00
02:00:00
03:00:00
04:00:00
4.5
05:00:00
06:00:00
07:00:00
08:00:00
09:00:00
10:00:00
2.1
11:00:00
12:00:00
13:00:00
14:00:00
15:00:00
16:00:00
4.5
17:00:00
18:00:00
19:00:00
20:00:00
21:00:00
22:00:00
1.9
23:00:00

<tbody>
</tbody>


What I need is a selection routine in excel-VBA like this:
Find the last non empty value (In this case 1.9)
Select last empty Value.
Select each cell up till the next non empty value. (In this case 4.5)
Use the following code to trend:
Code:
Selection.DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, _
        Trend:=True
Select that cell again (4.5)
Select each cell up till the next non empty value (In this case 2.1)
Trend.
Select that cell it finished on (2.1)
Select each cell up till the next non empty value(In this case 4.5 at the top of the table)
Trend.

That's pretty much all that needs to happen.
Can any shed some light on the process for this? I keep getting confused. It doesn't help that there are many different ways to do it either. Thanks in advance!
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,453
Messages
6,124,930
Members
449,195
Latest member
Stevenciu

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