+ Reply to Thread
Results 1 to 7 of 7

How do I insert an interger into a range?

  1. #1
    Registered User
    Join Date
    07-27-2012
    Location
    Sydney Aust
    MS-Off Ver
    Excel 2010
    Posts
    92

    How do I insert an interger into a range?

    Gday, how do I replace the 1000 with the value that HCCount returns?

    There might be an easier way

    All I want to do is copy B2 down the col to the amount stated in a cell A1 on another sheet


    Please Login or Register  to view this content.
    And if the A1 was on another sheet how would i ask it to look there?


    cheers

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How do I insert an interger into a range?

    Hi, ratdogexcel,

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: How do I insert an interger into a range?

    Please Login or Register  to view this content.
    if A1 is another sheet add sheet name in front
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  4. #4
    Registered User
    Join Date
    07-27-2012
    Location
    Sydney Aust
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: How do I insert an interger into a range?

    Perfect thanks a heap Humdingaling and everyone else


    Does the range reset when the sub ends? Or when i set the range again in another sub?

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How do I insert an interger into a range?

    Hi, ratdogexcel,

    according to Microsoft the scope of rng ends at the end of the macro in which it is defined. Furthermore it is declared as a local variable to work with so no other macro will know about that (if nopt passed as parameter).

    But I wonder why you would need to use 2 variables for performing an action that could be done without any variables at all (I try to avoid unnecessary variables as well as objects but if used try to clean up at the ened of the macro).

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    07-27-2012
    Location
    Sydney Aust
    MS-Off Ver
    Excel 2010
    Posts
    92

    Re: How do I insert an interger into a range?

    Thanks for the explanation

    I need to define the variable for each sheet.

    I perform the same action on multiple sheets but they relate to a different A1 each time.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: How do I insert an interger into a range?

    Hi, ratdogexcel,

    I need to define the variable for each sheet.
    Wrap the code you have in a loop like
    Please Login or Register  to view this content.
    and make the code relate to ws in order to get it to work on every sheet.

    ...but they relate to a different A1 each time
    Hard to help if you donīt mention on which system this is build.

    Ciao,
    Holger

+ 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. Help - Insert method of Range class failed - Selection.Insert Shift:=xlToRight
    By sandy@excelforum in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-04-2012, 11:14 AM
  2. Solver and Interger Programming Problem
    By hpman247 in forum Excel General
    Replies: 5
    Last Post: 10-08-2010, 12:51 AM
  3. Declaring Interger's
    By The_Vulcan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2006, 04:09 AM
  4. Display Positive Interger
    By scottnoddin77 in forum Excel General
    Replies: 7
    Last Post: 12-11-2006, 03:18 PM
  5. Weird interger calculation
    By Troi-Xanh in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-14-2005, 01:06 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