+ Reply to Thread
Results 1 to 2 of 2

How to highlight a range in a macro without replacing it with a range name such as C1:L15

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    Walkerton, Canada
    MS-Off Ver
    Excel 2010
    Posts
    9

    How to highlight a range in a macro without replacing it with a range name such as C1:L15

    Good Morning,

    I am using record to write this macro and I am coping F4 to AU4 to changing range. When using the record it assigns a range to it. I have a X at the bottom of the column so when I go end down it will stop at the X and than I go up one, I than want to highlight to the right 41 spaces and paste. The macro below is what I am using below however it is not working. The columns to right are consistant however the colums down are not. I would appreciate any help i can get. Thanks.


    Range("F4").Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Copy
    Range("F5").Select
    Range(Selection, Selection.End(xlDown)).Select
    ActiveCell.Offset(0, 40).Select
    ActiveSheet.Paste
    End Sub

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How to highlight a range in a macro without replacing it with a range name such as C1:

    Hi Mary

    Why don't you use select special last cell tp give you your last used cell?

    if you use record it gives you this:-

    Please Login or Register  to view this content.
    You can modify this to give you the row

    Please Login or Register  to view this content.
    You can modify this to give you the Column

    Please Login or Register  to view this content.

    So your code can be simplified to:-

    Please Login or Register  to view this content.
    Last edited by mehmetcik; 01-20-2014 at 04:21 PM.

+ 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] Macro Highlight & select different value in multiple range
    By feroguz in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 10-18-2012, 12:05 PM
  2. [SOLVED] Highlight range of cells - run macro - select last cell in range
    By chromachem in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-24-2012, 11:46 AM
  3. Macro for replacing range of values with one value
    By chrissim16 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-07-2010, 07:49 PM
  4. [SOLVED] [SOLVED] Macro to Highlight Range
    By LLoraine in forum Excel General
    Replies: 2
    Last Post: 04-19-2006, 09:45 AM
  5. [SOLVED] Highlight Range - wrong macro, please edit.
    By Danny in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-19-2005, 07:05 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