Range name

DaveUK

Board Regular
Joined
Jan 24, 2005
Messages
245
I have this code:

Sub FindNextEmptyCell()
' Finds next emptycell to the right of Row 4
Range("A4").End(xlToRight).Offset(0, 1).Select
End Sub

What i want to do is set this activecell to a name i can refer back to later, using the name "MIDS" and a cell 8 rows down named "NORTH".

Another piece of code i need is also to add the values of the 4 rows before the "MIDS" and store it in a variable called "iReports".

Any help appreciated.
 

Some videos you may like

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,218
Office Version
  1. 365
Platform
  1. Windows
Where do you want to use this name? In the code or as a named range on the worksheet?

How about this?
Code:
Sub FindNextEmptyCell() 
Dim MIDS As Range
Dim NORTH As Range

       Set MIDS=Range("A4").End(xlToRight).Offset(0, 1)
       Set NORTH=MIDS.Offset(8,0)
     
       ' rest of code to work with MIDS/NORTH
End Sub

For your other question can you give more information?

What do you mean by 'rows before'?
 

DaveUK

Board Regular
Joined
Jan 24, 2005
Messages
245
Sorry,

Yeah i want to use the name in the code.

Thanks for your help.
 

DaveUK

Board Regular
Joined
Jan 24, 2005
Messages
245
Sorry again, never noticed the other bit of the message.

Well say the "MIDS" cell is at "F8" then i want to add the values of "F4 - F7" and put the total in "F8".

Hope that makes sense.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,499
Messages
5,596,517
Members
414,074
Latest member
Matthew Kakde

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
Top