+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 15 of 38

Thread: Affiliate Worksheet Help

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Affiliate Worksheet Help

    I would like some help with a couple of worksheets... I hope someone can help me.

    This is what i need to do.

    Worksheet 1

    All the data I need is on worksheet 1 this is just some of the data for example,

    PROGRAMNAME PROGRAMURL NAME KEYWORDS DESCRIPTION SKU BUYURL IMPRESSIONURL
    Bejool http://www.bejool.com Bejool.com Sterling Silver Hoop Earrings Sterling Silver Hoop Earrings Sterling Silver Hoop Earrings Sterling Silver http://www.jdoqocy.com/click-

    Worksheet 2

    SKU post_title post_content post_excerpt type code starts expires url link featured packageID image images category

    What I need to do is map the fields from worksheet 1 to worksheet 2, and move all the data in most cases about 50,000 line.

    So I would need all the data from PROGRAMNAME on (worksheet 1) to be inserted under post_title on (worksheet 2)

    I hope this makes since.

    Thank You
    Robert
    Attached Files Attached Files

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Affiliate Worksheet Help

    your sample workbook2 should have the same data laid out how you would want it to appear from workbook1. Show us where everything goes, fill in a few rows so it's clear.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    I inserted the data just like I would need it for importing into my website.

    But here it is again in case it not to confusing.
    PROGRAMURL = url
    CATALOGNAME = category
    NAME = post_title (and) post_excerpt
    KEYWORDS = tags
    DESCRIPTION = post_content
    SKU = SKU
    BUYURL = link
    IMAGEURL = image (and) images
    STARTDATE = starts
    ENDDATE = expires
    Attached Files Attached Files

  4. #4
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Affiliate Worksheet Help

    So, each time this happens, the data on Worksheet2 is completely erased and all the worksheet1 data is added in the appropriate columns?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    Well I keep a copy and ftp it into the server, then I go to the admin panel of my script and upload it.

  6. #6
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Affiliate Worksheet Help

    Right, but you didn't answer my Excel question.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  7. #7
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    Sorry, Yes...

  8. #8
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Affiliate Worksheet Help

    Ok, simple enough then... put this macro into a standard code module in WORKSHEET 2 since that is where the data is being collected:

    Option Explicit
    
    Sub ImportNewSKUData()
    Dim wb1 As Workbook, wsCPO As Worksheet
    Dim LR As Long, WasOPEN As Boolean
    
    On Error Resume Next
    Set wb1 = Workbooks("Worksheet 1.xls")
    If Not wb1 Is Nothing Then
        WasOPEN = True
    Else
        Set wb1 = Workbooks.Open("C:\MyExcelFiles\Worksheet 1.xls")
    End If
    
    Set wsCPO = ThisWorkbook.Sheets("CPO Outlet")
    wsCPO.UsedRange.Offset(1).ClearContents
    
    With wb1.Sheets("Sheet1")
        LR = .Range("A" & Rows.Count).End(xlUp).Row
        .Range("H2:H" & LR).Copy wsCPO.Range("A2")      'SKU>SKU
        .Range("E2:E" & LR).Copy wsCPO.Range("B2")      'NAME>post_title
        .Range("G2:G" & LR).Copy wsCPO.Range("C2")      'DESCRIPTION>post_content
        .Range("E2:E" & LR).Copy wsCPO.Range("D2")      'NAME>post_excerpt
        .Range("B2:B" & LR).Copy wsCPO.Range("M2")      'PROGRAMURL>url
        .Range("R2:R" & LR).Copy wsCPO.Range("N2")      'BUYURL>link
        .Range("T2:T" & LR).Copy wsCPO.Range("S2:T2")   'IMAGEURL>image & images
        .Range("C2:C" & LR).Copy wsCPO.Range("U2")      'CATALOGNAME>category
        .Range("F2:F" & LR).Copy wsCPO.Range("X2")      'KEYWORDS>tags
    End With
    
    If Not WasOPEN Then wb1.Close False
    
    End Sub

    This macro will:
    1. Check to see if Worksheet 1.xls is already open and open it if it is not.
      (Be sure to edit the "path" to that file so the macro can find it when necessary)
    2. Clear the current CPO Outlet data
    3. Copy the mapped data from Worksheet 1.xls Sheet1 to CPO Outlet
    4. Close the Worksheet 1.xls file if it was originally closed
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  9. #9
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    That looks great, will I need to change the name on the code for each of the files.. since (CPO Outlet) was just 1 of 1250 different file names.

  10. #10
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Affiliate Worksheet Help

    We can reorganize this so that it works with "whatever" the activesheet happens to be.

    Option Explicit
    
    Sub ImportNewSKUData()
    Dim wb1 As Workbook, wsNEW As Worksheet
    Dim LR As Long, WasOPEN As Boolean
    
    If MsgBox("Process data into the activesheet?", _
        vbYesNo, "Confirm") = vbNo Then Exit Sub
    Set wsNEW = ActiveSheet
    
    On Error Resume Next
    Set wb1 = Workbooks("Worksheet 1.xls")
    If Not wb1 Is Nothing Then
        WasOPEN = True
    Else
        Set wb1 = Workbooks.Open("C:\MyExcelFiles\Worksheet 1.xls")
    End If
    
    wsNEW.UsedRange.Offset(1).ClearContents
    
    With wb1.Sheets("Sheet1")
        LR = .Range("A" & Rows.Count).End(xlUp).Row
        .Range("H2:H" & LR).Copy wsNEW.Range("A2")      'SKU>SKU
        .Range("E2:E" & LR).Copy wsNEW.Range("B2")      'NAME>post_title
        .Range("G2:G" & LR).Copy wsNEW.Range("C2")      'DESCRIPTION>post_content
        .Range("E2:E" & LR).Copy wsNEW.Range("D2")      'NAME>post_excerpt
        .Range("B2:B" & LR).Copy wsNEW.Range("M2")      'PROGRAMURL>url
        .Range("R2:R" & LR).Copy wsNEW.Range("N2")      'BUYURL>link
        .Range("T2:T" & LR).Copy wsNEW.Range("S2:T2")   'IMAGEURL>image & images
        .Range("C2:C" & LR).Copy wsNEW.Range("U2")      'CATALOGNAME>category
        .Range("F2:F" & LR).Copy wsNEW.Range("X2")      'KEYWORDS>tags
    End With
    
    If Not WasOPEN Then wb1.Close False
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  11. #11
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Affiliate Worksheet Help

    If you need we can make Excel prompt you to select the file to open and import from, too, so you have variable control of that without editing the macro.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  12. #12
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    I'm not sure I understand what it should do, I tried it a few times and nothing. Should I open the file with all the data or should I open both; I'm not sure.

    This is the folder that I keep all the data in. C:\Users\Robert\Desktop\CJ database files\CJ text deals\Extracted Files

    the names of the files are all different here are the first 4 in the folder
    1st in video
    4allmemory
    101Phones
    123Inkjets

    also if you would like I live in Modesto I can call you or I use Teamviewer for remote access.

  13. #13
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    "If you need we can make Excel prompt you to select the file to open and import from, too, so you have variable control of that without editing the macro. "

    I like this option, to be able to select each file.

  14. #14
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: Affiliate Worksheet Help

    OK, this version will import the workbook you select (a popup window will let you select the source file) into the currently activesheet.
    Option Explicit
    
    Sub ImportNewSKUData()
    'Imports a file you select into the activesheet
    Dim wb1 As Workbook, wsNEW As Worksheet
    Dim LR As Long, fNAME As String
    
    If MsgBox("Process data into the activesheet?", _
        vbYesNo, "Confirm") = vbNo Then Exit Sub
    Set wsNEW = ActiveSheet
    
    fNAME = Application.GetOpenFilename("Microsoft Office Excel Files (.xls),.xls")
    If fNAME = "False" Then Exit Sub
    
    On Error Resume Next
    Set wb1 = Workbooks.Open(fNAME)
    
    wsNEW.UsedRange.Offset(1).ClearContents
    
    With wb1.Sheets("Sheet1")
        LR = .Range("A" & Rows.Count).End(xlUp).Row
        .Range("H2:H" & LR).Copy wsNEW.Range("A2")      'SKU>SKU
        .Range("E2:E" & LR).Copy wsNEW.Range("B2")      'NAME>post_title
        .Range("G2:G" & LR).Copy wsNEW.Range("C2")      'DESCRIPTION>post_content
        .Range("E2:E" & LR).Copy wsNEW.Range("D2")      'NAME>post_excerpt
        .Range("B2:B" & LR).Copy wsNEW.Range("M2")      'PROGRAMURL>url
        .Range("R2:R" & LR).Copy wsNEW.Range("N2")      'BUYURL>link
        .Range("T2:T" & LR).Copy wsNEW.Range("S2:T2")   'IMAGEURL>image & images
        .Range("C2:C" & LR).Copy wsNEW.Range("U2")      'CATALOGNAME>category
        .Range("F2:F" & LR).Copy wsNEW.Range("X2")      'KEYWORDS>tags
    End With
    
    wb1.Close False
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  15. #15
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    You are awesome... it works great

    I don't have much, but can I donate or buy you lunch? via paypal

+ 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.2.0