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
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 theicon 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!)
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
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 theicon 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!)
Well I keep a copy and ftp it into the server, then I go to the admin panel of my script and upload it.
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 theicon 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!)
Sorry, Yes...
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:
- 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)- Clear the current CPO Outlet data
- Copy the mapped data from Worksheet 1.xls Sheet1 to CPO Outlet
- 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 theicon 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!)
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.
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 theicon 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!)
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 theicon 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!)
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.
"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.
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 theicon 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!)
You are awesome... it works great
I don't have much, but can I donate or buy you lunch? via paypal
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks