+ Reply to Thread
Results 1 to 3 of 3

Using a variable to define a range in VBA

  1. #1
    Registered User
    Join Date
    04-18-2011
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    70

    Using a variable to define a range in VBA

    Hi,

    I have 2 questions:

    Question 1

    I have a sheet with cols A:K, row 1 is the headings. Cell N1 is a calculation to return how many rows there are is a different part of the work book.

    for this assume that N1=100

    In A2:K2 I have formulea that need copied down 100 rows (given that N1=100)

    I have tried the following code:

    Please Login or Register  to view this content.
    But this is not working.

    Please can someone help me, i cannot work out what is wrong with it!

    Question 2

    I have a column that is populated with different text values and some blanks, what VBA would i use to search this column and replace all blank cells with the word "BLANK"

    I have tried

    Please Login or Register  to view this content.
    Thanks very much in advance

    P.S. I only started looking at VBA recently so i apologize if these are simple/stupid questions..
    Last edited by MysticGenius; 11-01-2011 at 01:40 AM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Using a variable to define a range in VBA

    hi, MysticGenius,

    Question1:

    Please Login or Register  to view this content.
    Question 2:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-18-2011
    Location
    Melbourne
    MS-Off Ver
    Excel 2003
    Posts
    70

    Re: Using a variable to define a range in VBA

    Quote Originally Posted by watersev View Post
    hi, MysticGenius,

    Question1:

    Please Login or Register  to view this content.
    thanks very much for that.

    I have encountered a problem, if i use:

    Please Login or Register  to view this content.
    I get an error:

    Method "Range" of object global fail

    Could this be to do with the range used in B1, as it is over 11,000, or is it more to do with the AK?

    Thanks

    thanks
    Last edited by MysticGenius; 11-01-2011 at 10:19 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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