+ Reply to Thread
Results 1 to 6 of 6

Copying data by VBA using Current Region Property

  1. #1
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Copying data by VBA using Current Region Property

    I am trying to copy the data from all the years from 2006 to 2012 to all "task1" sheet. But the condition is that when new data is in any of the sheet after row 55 it should show in "task 1" sheet when I run the macro. I tried this code using current region property for sheet "year 2006". But when used the same code for" year 2007" and so on the macro also copies column A which I don't want onwards 2006 as the column A is same for all years.

    Please Login or Register  to view this content.
    I am trying to avoid loop.
    Attached Files Attached Files
    Last edited by Farhasnat; 12-27-2021 at 08:39 AM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,620

    Re: Copying data by VBA using Current Region Property

    Well, I've opened the file and ...
    column A is not the same for all years
    in 2006 INTEREST is in A8, while in 2007 in A11 and so on

    By the way, why you try to use currentregion at all?

    Please Login or Register  to view this content.

    If the reason is because the content of column A is different some years, the the approach would be quite different (depending on the character of changes of colunm A content)
    Best Regards,

    Kaper

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Copying data by VBA using Current Region Property

    Instead of
    Please Login or Register  to view this content.
    Use
    Please Login or Register  to view this content.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Copying data by VBA using Current Region Property

    If you want to copy sheets from 2007 to 2013
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-14-2021
    Location
    Bangkok
    MS-Off Ver
    MS Office 365, Verision 16.55
    Posts
    52

    Re: Copying data by VBA using Current Region Property

    Quote Originally Posted by kvsrinivasamurthy View Post
    Instead of
    Please Login or Register  to view this content.
    Use
    Please Login or Register  to view this content.
    Thank you ! This worked perfectly ! Just for my learning, I understand that Range B10 is selected and is it offsetting 4 rows and 1 cloumn from there ?

  6. #6
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Copying data by VBA using Current Region Property

    Any cell selected within the region the currentregion will select the entire range. Since you have selected B11, I selected B10. The address is A7: last cell in region.

    Since data is required from B11, Which is offset(4,1) from A7, offset is used. After the offset the range starts from B11.
    Since only one column is required resize(,1) is used.
    I hope I am clear.

+ 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. [SOLVED] Using current region
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-10-2015, 04:39 PM
  2. [SOLVED] When Your copying data using current Region How can you copy the format also?
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-22-2014, 03:50 PM
  3. Copying & pasting a current region to another sheet w/o actually copying.....
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2014, 09:08 PM
  4. [SOLVED] Issue w/ Current Region, Select 3 Columns of Data without selecting adjacent columns
    By EnigmaMatter in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-10-2014, 02:57 PM
  5. Current Region difference between two data sets
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 10-23-2013, 08:51 PM
  6. write data to worksheet using rowcount current region
    By Hyperlink in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-27-2013, 03:48 AM
  7. Replies: 1
    Last Post: 10-04-2007, 12:04 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