+ Reply to Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 38

Thread: Affiliate Worksheet Help

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

    Re: Affiliate Worksheet Help

    Since you have opened up my eyes about what Excel can do, dealing with that same file system the columns that do not have data to import I have to enter manually for example

    Column E (type) I can put either Coupon or offer
    Column V (post_type) needs the word post
    Column W (post_status) should have the word publish

    Can this also be done?

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

    Re: Affiliate Worksheet Help

    Column E, no, Excel won't know whether you want "coupon" or "offer"
    Column V and W, sure, since it's the same for all rows...

    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
    
    LR = Range("A" & Rows.Count).End(xlUp).Row
    Range("V2:V" & LR).Value = "post"
    Range("W2:W" & LR).Value = "publish"
    
    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!)

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

    Re: Affiliate Worksheet Help

    Jerry,

    I have run across another issue that I think you can help me with, some of my files are larger then 65536 line can we write into the macro that if it is more then 65536 then it will split it up into multi workbooks that are say 30,000 each or something like that.

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

    Re: Affiliate Worksheet Help

    Off hand, there's nothing in this entire project that is compatible with that idea. You are opening one workbook and mapping the data into another workbook in a specific order.... you are opening the workbooks and copy data around ... so you can't open workbooks with more than 65k rows of data.

    If your data is in files longer that 65k rows of data, upgrade to Excel 2007 or higher, this is a business expense, and a minor one.

    Once you are able to open these Excel files of greater length, then you could break it down into smaller subsets of 30k rows.
    _________________
    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. #20
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    Thank You,

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

    Re: Affiliate Worksheet Help

    I am in need of an update on my macro,
    The code is below at bottom...

    What I need help with is.
    1) Column (O) needs to say "Active" from O2: to the end of the sheet.
    2) Column (P) needs to say "Yes" from P2: to the end of the sheet.
    3) Column (AK) needs to have either the number (1) or (0)
    4) Column (AL) needs to have either the number (1) or (0)
    5) Column (AP) needs to have options (Merchant Coupon) (Offers) (Deals)

    On the last one you did for me you used the following. but it does not seam to work with Excel 2007
    I was using 2003 before.
    wb1.Close False
    
    LR = Range("A" & Rows.Count).End(xlUp).Row
    Range("E2:E" & LR).Value = "offer"
    Range("V2:V" & LR).Value = "post"
    Range("W2:W" & LR).Value = "publish"
    This is what I have so far and it does most of the job but I can't get the rest to work.
    Option Explicit
    
    Sub PHPIMPORT()
    '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("E2:E" & LR).Copy wsNEW.Range("B2")      'NAME>TITLE
        .Range("G2:G" & LR).Copy wsNEW.Range("C2")      'DESCRIPTION>DESCRIPTION
        .Range("E2:E" & LR).Copy wsNEW.Range("BD2")     'NAME>MCOUPON_TAG
        .Range("B2:B" & LR).Copy wsNEW.Range("D2")      'PROGRAMURL>URL
        .Range("R2:R" & LR).Copy wsNEW.Range("BC2")     'BUYURL>AFFURL
        .Range("R2:R" & LR).Copy wsNEW.Range("BE2")     'BUYURL>MCOUPON_URL
        .Range("T2:T" & LR).Copy wsNEW.Range("BI2")     'IMAGEURL>MCOUPON_LOGO
        .Range("C2:C" & LR).Copy wsNEW.Range("L2")      'CATALOGNAME>CATEGORY_ID
        .Range("F2:F" & LR).Copy wsNEW.Range("AT2")     'KEYWORDS>META_KEYWORDS
        .Range("G2:G" & LR).Copy wsNEW.Range("BG2")     'DESCRIPTION>MCOUPON_DESC
        .Range("N2:N" & LR).Copy wsNEW.Range("AW2")     'SALEPRICE>PRICE
        .Range("T2:T" & LR).Copy wsNEW.Range("AX2")     'IMAGEURL>IMAGE
        .Range("C2:C" & LR).Copy wsNEW.Range("AZ2")     'CATALOGNAME>STORE_ID
    End With
    
    wb1.Close False
    
    End Sub
    Last edited by Paul; 04-11-2012 at 07:04 PM. Reason: Added CODE tags. Please remember to do this yourself in the future.

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

    Re: Affiliate Worksheet Help

    Maybe:

    wb1.Close False
    
    With wsNEW
        LR = .Range("A" & .Rows.Count).End(xlUp).Row
        .Range("E2:E" & LR).Value = "offer"
        .Range("V2:V" & LR).Value = "post"
        .Range("W2:W" & LR).Value = "publish"
    End With
    _________________
    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!)

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

    Re: Affiliate Worksheet Help

    That code is for another macro.

    The new macro needs something similar

    1) Column (O) needs to say "Active" from O2: to the end of the sheet.
    2) Column (P) needs to say "Yes" from P2: to the end of the sheet.
    3) Column (AK) needs to have either the number (1)
    4) Column (AL) needs to have either the number (1)
    5) Column (AP) needs to have options (Merchant Coupon)

    So if I follow you it should look like this
    _______________________________________________________
    wb1.Close False

    With wsNEW
    LR = .Range("A" & .Rows.Count).End(xlUp).Row
    .Range("O2:O" & LR).Value = "Active"
    .Range("P2:P" & LR).Value = "Yes"
    .Range("AK2:AK" & LR).Value = "1"
    .Range("AL2:AL" & LR).Value = "1"
    .Range("AP2:AP" & LR).Value = "Merchant Coupon"


    End With
    _______________________________________________________

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

    Re: Affiliate Worksheet Help

    I'm not sure what you mean by "needs to have the options (Merchant Coupon)", but as for the rest, that looks right. When you tested it?
    _________________
    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!)

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

    Re: Affiliate Worksheet Help

    "needs to have the options (Merchant Coupon)", I had 3 options but I forgot the last time you helped me you stated that I would not be able to pick the option I needed.

    Here is the sheet after i run the macro.
    Attached Files Attached Files

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

    Re: Affiliate Worksheet Help

    1) You can possibly pick the options you need if you explain them, demonstrate them fully in these same sheets you're uploading.

    2) The sheet you uploaded in #25 doesn't have any code for me to troubleshoot.

    3) The code snippet I gave you in #22 shows how to insert values in Row2:LastRowOfData, but your sample sheet from #25 shows your gray cells as being pasted into Row1, so your application of the code I gave you has been edited.
    _________________
    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. #27
    Registered User
    Join Date
    02-07-2012
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    26

    Re: Affiliate Worksheet Help

    OK, Let me start from scratch sheet 1 will be the file I need to convert, sheet 2 will be the import fields, sheet 3 will be the macro code, and there is a image of the idea if it is possible.

    What I need is for

    Cell (O2) to have the word "Active"
    Cell (P2) to have a choice of "Yes" or "No" --- Maybe a box could pop up and I have to pick one.
    Cell (AK2) to have a choice of "Yes" or "No" ---
    Cell (AL2) to have a choice of "Yes" or "No" ---
    Cell (AP2) to have a choice of "Deals" , "Offer" or "Merchant Coupon" ---

    If it is possible to have a box pop up with check box's (see image)

    I hope this helps and thank you very much



    **** ALSO EVERY TIME I OPEN EXCEL THE FILE (PERSONAL) OPENS SO I HAVE TO CLOSE THAT FILE AND CLICK NEW ***
    Can you please tell me how to disable that.excel-pop-up-box.gifSheet 1.xlsSheet 2.xlsm

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

    Re: Affiliate Worksheet Help

    You can use popup questions like so.. this shows you first how to apply a simple data validation drop down selection box to a range of cells, and since there are only a couple of choices, a neat trick for using the YES/NO buttons on a standard Excel MsgBox to make the default choices:

    'Column P example
        With Range("P2:P" & LR).Validation
            .Delete
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Yes, No"
            .IgnoreBlank = True
            .InCellDropdown = True
            .InputTitle = ""
            .ErrorTitle = ""
            .InputMessage = ""
            .ErrorMessage = ""
            .ShowInput = True
            .ShowError = True
            .Parent.Value = WorksheetFunction.Lookup(MsgBox("Click the button that will be the default value for Column P", vbYesNo), Array(6, 7), Array("Yes", "No"))    End With
    
    'Column AP example
        With Range("AP2:AP" & LR).Validation
            .Delete
            .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Deals, Offer, Merchant Coupon"
            .IgnoreBlank = True
            .InCellDropdown = True
            .InputTitle = ""
            .ErrorTitle = ""
            .InputMessage = ""
            .ErrorMessage = ""
            .ShowInput = True
            .ShowError = True
            .Parent.Value = WorksheetFunction.Lookup(MsgBox("Click the button that will be the default value for Column P" _
                & vbLf & vbLf & "Yes = 'Deals'" & vbLf & "No = 'Offer'" & vbLf & "Cancel = 'Merchant Coupon'", vbYesNoCancel, "Choose"), _
                Array(2, 6, 7), Array("Merchant Coupon", "Deals", "Offer"))
        End With
    _________________
    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!)

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

    Re: Affiliate Worksheet Help

    Is this everything I need or just an example?

    I ran it the way it is and I get a compile error with this line.

    .Parent.Value = WorksheetFunction.Lookup(MsgBox("Click the button that will be the default value for Column P", vbYesNo), Array(6, 7), Array("Yes", "No")) End With

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

    Re: Affiliate Worksheet Help

    So I'm not sure what happened but nothing went into (P), nothing went into (O), nothing went into (AK), nothing went into (AL) & nothing went into (AP)...

    The worksheet that needed to imported had some information in it but it was all wrong.

    I'm not sure what all the commands are for so I can't try and figure it out myself. I will give it my best try and maybe you can correct my errors.

    This is what I need added to the original sheet you made me.
    Cell (O2) to have the word "Active"
    Cell (P2) to have a choice of "Yes" or "No" --- Maybe a box could pop up and I have to pick one.
    Cell (AK2) to have a choice of "Yes" or "No" ---
    Cell (AL2) to have a choice of "Yes" or "No" ---
    Cell (AP2) to have a choice of "Deals" , "Offer" or "Merchant Coupon" ---



    Here is the one you made me before. I changed a few thing to work with my new format but this part works great.
    Sub PHPIMPORT()
    '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("E2:E" & LR).Copy wsNEW.Range("B2") 'NAME>TITLE
    .Range("G2:G" & LR).Copy wsNEW.Range("C2") 'DESCRIPTION>DESCRIPTION
    .Range("E2:E" & LR).Copy wsNEW.Range("BD2") 'NAME>MCOUPON_TAG
    .Range("B2:B" & LR).Copy wsNEW.Range("D2") 'PROGRAMURL>URL
    .Range("R2:R" & LR).Copy wsNEW.Range("BC2") 'BUYURL>AFFURL
    .Range("R2:R" & LR).Copy wsNEW.Range("BE2") 'BUYURL>MCOUPON_URL
    .Range("T2:T" & LR).Copy wsNEW.Range("BI2") 'IMAGEURL>MCOUPON_LOGO
    .Range("C2:C" & LR).Copy wsNEW.Range("L2") 'CATALOGNAME>CATEGORY_ID
    .Range("F2:F" & LR).Copy wsNEW.Range("AT2") 'KEYWORDS>META_KEYWORDS
    .Range("G2:G" & LR).Copy wsNEW.Range("BG2") 'DESCRIPTION>MCOUPON_DESC
    .Range("N2:N" & LR).Copy wsNEW.Range("AW2") 'SALEPRICE>PRICE
    .Range("T2:T" & LR).Copy wsNEW.Range("AX2") 'IMAGEURL>IMAGE
    .Range("C2:C" & LR).Copy wsNEW.Range("AZ2") 'CATALOGNAME>STORE_ID
    End With


    Now I will try and do as much as I can.


    wb1.Close False

    LR = Range("A" & Rows.Count).End(xlUp).Row

    Range("O2:O" & LR).Value = "Active"

    Range("P2:P" & LR).Validation
    .Delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Yes, No"
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = ""
    .InputMessage = ""
    .ErrorMessage = ""
    .ShowInput = True
    .ShowError = True
    .Parent.Value = WorksheetFunction.Lookup(MsgBox("Click the button that will be the default value for Column P", vbYesNo), Array(6, 7), Array("Yes", "No"))

    End With

    Range("AK2:AK" & LR).Validation
    .Delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Yes, No"
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = ""
    .InputMessage = ""
    .ErrorMessage = ""
    .ShowInput = True
    .ShowError = True
    .Parent.Value = WorksheetFunction.Lookup(MsgBox("Click the button that will be the default value for Column AK", vbYesNo), Array(6, 7), Array("Yes", "No"))

    End With

    Range("AL2:AL" & LR).Validation
    .Delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Yes, No"
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = ""
    .InputMessage = ""
    .ErrorMessage = ""
    .ShowInput = True
    .ShowError = True
    .Parent.Value = WorksheetFunction.Lookup(MsgBox("Click the button that will be the default value for Column AL", vbYesNo), Array(6, 7), Array("Yes", "No"))

    End With

    Range("AP2:AP" & LR).Validation
    .Delete
    .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="Deals, Offer, Merchant Coupon"
    .IgnoreBlank = True
    .InCellDropdown = True
    .InputTitle = ""
    .ErrorTitle = ""
    .InputMessage = ""
    .ErrorMessage = ""
    .ShowInput = True
    .ShowError = True
    .Parent.Value = WorksheetFunction.Lookup(MsgBox("Click the button that will be the default value for Column P" _
    & vbLf & vbLf & "Yes = 'Deals'" & vbLf & "No = 'Offer'" & vbLf & "Cancel = 'Merchant Coupon'", vbYesNoCancel, "Choose"), _
    Array(2, 6, 7), Array("Merchant Coupon", "Deals", "Offer"))
    End With

    End Sub


    OK; so this is what I have done, I will try it but, I don't think it's going to work.

+ 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