+ Reply to Thread
Results 1 to 25 of 25

Open different workbook and store data to variables

Hybrid View

  1. #1
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646
    That piece of code sets the range to copy.

    "A1" is the start of the range.

    .Range("A" & Rows.Count).End(xlUp finds the last row of data in column A by going to the bottom of the column and moving upwards, just as you would do it manually with the End key.

    We combine these to get a reference to the range we want to copy.

    If you only want to copy from A1 down to the first occurrence of 'End' you could try something like this.
    FirstEndRow = Application.Match("End",.Range("A:A"), 0)
    Set rngSrc = .Range("A1:A" &FirstEndRow)
    That's untested, it should work though.
    If posting code please use code tags, see here.

  2. #2
    Forum Contributor
    Join Date
    04-11-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    108

    Re: Open different workbook and store data to variables

    I set it As String and it works. Is that correct procedure?

+ 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