+ Reply to Thread
Results 1 to 2 of 2

macro to create a range name

  1. #1
    Registered User
    Join Date
    08-02-2018
    Location
    Singapore
    MS-Off Ver
    5.0
    Posts
    7

    macro to create a range name

    Hi
    I’m trying to open a spreadsheet and go to the last cell in A that has data and create a range name. (here)
    That after another macro (macro1) delete the range name (here) and drop down one cell.
    This is what I have: the part that range names the cell doesn’t work


    Private Sub Worksheet_activate()

    Range("A5").Select

    ActiveWindow.FreezePanes = True
    x = Range("a" & Rows.Count).End(xlUp).Row
    Range("A" & x + 1).Select
    ActiveWindow.ScrollRow = ActiveCell.Row - 8
    ActiveCell.Offset(-1, 0).Range("A1").Select
    ' can't get this to work
    ActiveWorkbook.Names.Add Name:="here"

    Macro1
    ActiveWorkbook.Names("here").Delete
    ActiveCell.Offset(1, 0).Range("A1").Select
    End Sub

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,912

    Re: macro to create a range name

    Your post does not comply with Rule 2 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Click on Edit to open your thread, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 6)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] how to create a dynamic range with another macro
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-18-2017, 02:44 PM
  2. [SOLVED] Macro to create a range of cells containing shapes
    By NickyC in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-03-2015, 12:22 AM
  3. How to create macro with keystrokes to be used anywhere w/o a range
    By dd.oliver in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2015, 02:32 AM
  4. [SOLVED] How do I create a macro to copy a dynamic range?
    By Student1990 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-10-2013, 01:16 PM
  5. [SOLVED] Set Range, Create PDF, send via Outlook...1 Macro?!
    By Konsti1989 in forum Excel General
    Replies: 16
    Last Post: 12-04-2012, 12:44 PM
  6. macro to create named range
    By LMHmedchem in forum Excel General
    Replies: 7
    Last Post: 09-06-2011, 07:32 PM
  7. create a range from two value macro
    By skimura in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-02-2010, 12:13 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1