+ Reply to Thread
Results 1 to 7 of 7

Question about range in VBA

  1. #1
    Registered User
    Join Date
    01-19-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    12

    Question about range in VBA

    Hi,

    Please Login or Register  to view this content.
    I would like to paste some data in two sheets. There are totally 6 files data. I try to use range, offset and end function to find the last cell of the column, to prevent replace the data pasted before. But the code shows defined error.

    I am not familiar with VBA, so, I dont know how to make my idea into real. What should I change to make this code work??

    Thank you!

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Question about range in VBA

    What you need to do is pick a start point, go down to the end, the offset by a row

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Question about range in VBA

    Since a and b are ranges already you don't need Range().

    So the code would look like this.
    Please Login or Register  to view this content.
    By the way, finding the next empty row should be a little easier with something like this.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Registered User
    Join Date
    01-19-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Question about range in VBA

    Quote Originally Posted by Norie View Post
    Since a and b are ranges already you don't need Range().

    So the code would look like this.
    Please Login or Register  to view this content.
    By the way, finding the next empty row should be a little easier with something like this.
    Please Login or Register  to view this content.
    Thanks for your reply!
    The suggestion shows application-defined or object-defined error. Am I missing something important???

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Question about range in VBA

    How many arrays are contained in the array Arr?

    Can you post the rest of the code?

  6. #6
    Registered User
    Join Date
    01-19-2014
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    12

    Re: Question about range in VBA

    Quote Originally Posted by Norie View Post
    How many arrays are contained in the array Arr?

    Can you post the rest of the code?
    Please Login or Register  to view this content.

    There are totally 6 files, so, there should be 6 arrays.

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: Question about range in VBA

    There's actually only one array in the code, Arr.

    The reason I thought you that Arr actually contained other arrays was because of code like this.
    Please Login or Register  to view this content.
    That looks as though you are trying to find the upper bound of the first dimension of an array that's held in Arr(FNum,1).

    I've got a feeling that isn't what you want to do.

    If you want to find the upper bound of the first dimension of the array Arr you would use this.
    Please Login or Register  to view this content.

+ 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: 4
    Last Post: 07-26-2013, 03:38 PM
  2. [SOLVED] Question regarding conditional format question that covers two range criteria
    By lilsnoop in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-06-2013, 12:32 PM
  3. Range Question
    By amcaden in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-21-2010, 04:08 PM
  4. [SOLVED] Range Question / error 1004: method Range of object Worksheet has failed
    By Paul in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-07-2005, 10:06 AM
  5. Range Question
    By Ray Batig in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-18-2005, 09: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