+ Reply to Thread
Results 1 to 3 of 3

Error when selecting range

  1. #1
    Registered User
    Join Date
    08-11-2011
    Location
    Blanchard, Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    10

    Error when selecting range

    Hello, I am trying to write a macro that will place text in a specific cell... if that cell is already used, then it will try to fill the next cell, and so on.
    Below is the code I have written

    Please Login or Register  to view this content.
    My problem is that every time I try to run the macro, it errors out at this line...

    Please Login or Register  to view this content.
    I thought that you could use a variable for a range selection, is this not the case?

    Any advice would be appreciated.

    Thanks

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Error when selecting range

    I'm guessing you were trying to cast the strCell, try the following revision
    Please Login or Register  to view this content.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    08-11-2011
    Location
    Blanchard, Oklahoma
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Error when selecting range

    Perfect, that did the trick.
    You are correct, I was assuming that Range() required only a string argument. I did not realize that I could combine both string and integer.

    Thank you for the assistance.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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