+ Reply to Thread
Results 1 to 4 of 4

Problem setting values for a range

  1. #1
    Registered User
    Join Date
    06-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    42

    Problem setting values for a range

    Hello,

    I am trying to set some values for a range but am a bit stuck.
    When using this code it works fine:
    Please Login or Register  to view this content.
    But when using this code i get a Run Time Error 1004
    Please Login or Register  to view this content.
    Can any body help me here and point out why this produces an error, i want to use the second option to set values for a variable range and prefer to use the Cells() method?

    Thanks!

  2. #2
    Forum Contributor banaanas's Avatar
    Join Date
    08-26-2014
    Location
    Finland
    MS-Off Ver
    2016
    Posts
    199

    Re: Problem setting values for a range

    Could you provide your workbooks? Would be easier that way.
    I think this might be caused because you need to clarify what workbook and cells you are refeering to, and the later part of your code is trying to reference the book2 cells.

    You could try to add this bit of code at the start of the module:

    Please Login or Register  to view this content.
    And replace that line of code with:

    Please Login or Register  to view this content.
    As you can see the difference is that my line is refering to a specific workbooks worksheets cells.
    Tuomas "Banaanas" Savonius
    Trying to give back now when I actually can do some VBA

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

    Re: Problem setting values for a range

    Try


    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  4. #4
    Registered User
    Join Date
    06-07-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Problem setting values for a range

    Thank you very much i think you helped me figure it out.

    The issue was the way i selected my range, i was using
    Please Login or Register  to view this content.
    Whereas, the way your wrote it using works just fine
    Please Login or Register  to view this content.
    I tried it and all working! thanks again.

+ 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. Replies: 11
    Last Post: 07-15-2012, 04:08 PM
  2. Problem with setting range in Macro
    By floridagunner in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-21-2012, 10:05 PM
  3. Problem setting range in macro based on todays date.
    By shakeyjake200 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-15-2009, 12:48 AM
  4. Problem When Setting Checkbox Values
    By rcoates in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2009, 06:44 PM
  5. Range setting problem
    By 63falcon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-09-2007, 04:37 PM
  6. [SOLVED] Problem setting SeriesCollections source range
    By Lead Foot in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-27-2006, 01:15 AM
  7. [SOLVED] Problem setting RGB Values with ShapeRange
    By Bob Gibbons in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-26-2005, 06:05 PM

Tags for this Thread

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