+ Reply to Thread
Results 1 to 2 of 2

Copying data to tabs with similar names

  1. #1
    Registered User
    Join Date
    12-29-2016
    Location
    wisconsin
    MS-Off Ver
    Office 2010
    Posts
    20

    Copying data to tabs with similar names

    Hello everyone, I am having some problems with my program at the moment. Right now it is designed to copy data from a master list and paste it to a sheet with the same name. However, that has caused some problems because I have parts with similar names that both need to be on the same sheet. For example, parts 1111A and 1111BA need to both be on sheet 1111. At the moment if the code runs into this problem it just shoots out an error code and stops. Is there any "match" or "similar" function in VBA to accomplish this? Any help would be greatly appreciated.

    [CODE][/Sub Update_Database()
    '
    ' Update_Database Macro
    '
    ' Keyboard Shortcut: Ctrl+j
    '

    Dim strSourceSheet As String
    Dim strDestinationSheet As String
    Dim lastRow As Long

    strSourceSheet = "Master Sheet"

    Sheets(strSourceSheet).Visible = True
    Sheets(strSourceSheet).Select

    Range("A2").Select
    Do While ActiveCell.Value <> ""
    strDestinationSheet = (ActiveCell.Value)
    ActiveCell.Resize(1, ActiveCell.CurrentRegion.Columns.Count).Select
    Selection.Copy
    Sheets(strDestinationSheet).Visible = True
    Sheets(strDestinationSheet).Select
    lastRow = Cells(Rows.Count, "A").End(xlUp).Row
    Cells(lastRow + 1, 1).Select
    Selection.PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    Sheets(strSourceSheet).Select
    ActiveCell.Offset(0, 0).Select
    ActiveCell.Offset(1, 0).Select
    Loop
    End SubCODE]

    This is my current code and I am guessing that the addition would need to be in the "stDestinationSheet = (ActiveCell.Value)" line of code but I am not sure since I am very new to VBA.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,631

    Re: Copying data to tabs with similar names

    Welcome to the Forum, unfortunately this is a duplicate post and as such will now be closed, you may continue in your other thread.

    Thread Closed.
    Ben Van Johnson

+ 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] Finding similar tabs compared to data
    By Jacobg38 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 01-12-2017, 02:15 PM
  2. Copying data to tabs with similar names
    By Jacobg38 in forum Excel General
    Replies: 0
    Last Post: 01-10-2017, 04:54 PM
  3. [SOLVED] deleted the post
    By joparo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-22-2015, 07:00 AM
  4. Removing similar names from a data
    By cksrules in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-29-2011, 05:23 AM
  5. Removing similar names from a data
    By cksrules in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-27-2011, 06:42 AM
  6. Copying the data from tabs to consolidated tab
    By raghunaik in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-17-2009, 08:24 AM
  7. [SOLVED] Import data from two workbooks with similar names
    By John in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-06-2005, 09:05 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