+ Reply to Thread
Results 1 to 3 of 3

Excel Resize using a negative reference

Hybrid View

TheMechEngineer Excel Resize using a negative... 07-30-2019, 06:48 PM
Leith Ross Re: Excel Resize using a... 07-30-2019, 08:15 PM
mohadin Re: Excel Resize using a... 07-31-2019, 02:40 AM
  1. #1
    Forum Contributor
    Join Date
    06-14-2016
    Location
    Brookland, Arkansas
    MS-Off Ver
    2007,2021
    Posts
    132

    Excel Resize using a negative reference

    Hi I am trying to use resize to make a range, and I want to use cells in my excel sheet to determine the resize value. Everything works fine for a positive resize (to the right or down). But I cant get it to work for a negative resize. What is the issue with my code?

    This Works
    Set Left = A.Resize(1, Range("B1").Value)
    This Doesn't
    Set Left = A.Resize(1, -Range("B1").Value)
    Who needs a life when you have Excel.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Excel Resize using a negative reference

    Hello TheMechEngineer,

    As you have discovered, Resize only uses positive values. To go in a "negative" direction use Offset.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Valued Forum Contributor
    Join Date
    06-27-2010
    Location
    sYRIA
    MS-Off Ver
    Excel 2013
    Posts
    669

    Re: Excel Resize using a negative reference

    Hi,
    as Mr. Leith mentioned:
    Set left = (Cells(1, 5).Offset(0, -Range("B1").Value).Resize(1, Range("B1").Value))

+ 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] Substracting from total if a cell reference(s) is negative
    By kschmit1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-04-2018, 02:39 PM
  2. [SOLVED] Pairing negative and positive numbers if the have the same reference in another column
    By lctwigg in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-22-2016, 06:46 AM
  3. Replies: 3
    Last Post: 08-07-2013, 11:29 AM
  4. numberformat with cell reference for negative numbers
    By batsheva in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-09-2013, 05:59 AM
  5. [SOLVED] Match positive and negative values with the same assignment/reference
    By nicklasj in forum Excel General
    Replies: 4
    Last Post: 09-10-2012, 03:14 PM
  6. [SOLVED] I could NOT resize the axis title but excel allows me to resize gr
    By Iwan Setiyono Ko in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 06-05-2006, 11:50 PM
  7. I could NOT resize the axis title but excel allows me to resize gr
    By Iwan Setiyono Ko in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-15-2006, 06:40 AM

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