Macro Help!!

siasarma

New Member
Joined
Sep 20, 2008
Messages
46
I am trying to create a Macro to Select all the cells in B:G And assign them the range name "List." But my macro won't work...I was wondering if somebody could tell me if there is something wrong with my macro...here's what it looks like:

Sub MasterInventoryList()
'
' MasterInventoryList Macro
' Macro recorded 10/3/2008 by Josiah
'
'
Columns("B:G").Select
Application.Goto Reference:="List"
Range("A1").Select
End Sub
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Try

Code:
Sub MasterInventoryList()
'
' MasterInventoryList Macro
' Macro recorded 10/3/2008 by Josiah
'
'
Columns("B:G").Name = "List"
End Sub
 
Upvote 0
I would use this:

ActiveWorkbook.Names.Add Name:="new", RefersToR1C1:="='Sheet1'!C2:C7"


"new" = the name of the range
'Sheet1' = the sheet i have it created on
"C2:C7" = Columns B to G


Is this what you were looking to do?

***********************************************************
Ha, nvm Columns("B:G").Name = "List" is much better
 
Upvote 0

Forum statistics

Threads
1,215,335
Messages
6,124,327
Members
449,155
Latest member
ravioli44

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