Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Exporting Data?

I am exporting data from the web. I export unto a file called Zack's
Export.xlsm. From here I select the data that I want to put into another
..xlsm file table so that I can later sort the data. How can I pick and choose
the data by column headings? For example, it makes no sense to have relative
data that exports from the web in columns A and Z, when I can have them side
by side; A&B. I am guessing the best way to do this is by column heading
recognition? How can I do this? If I am going about it all wrong please tell
me?
--
Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Exporting Data?

the macro below copies data from sheet 1 to the correct column in sheet 2
like this

sheet1
Header Data
a 1
b 2
c 3
b 5

sheet2
a b c
1
2
3
5

Sub test()

Set sht1 = Sheets("Sheet1")
Set Sht2 = Sheets("Sheet2")

With Sht2
LastCol = .Rows(1, Columns.Count).End(xlToLeft).Column
NewRow = 2
End With
RowCount = 2
With sht1
Do While .Range("A" & RowCount) < ""
'data to copy from sheet 1
HeaderData = .Range("A" & RowCount)
Data = .Range("B" & RowCount)
With Sht2
'look for header in row 1 on sht 2
Set c = .Rows(1).Find(what:=HeaderData, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
'put data in new column
.Cells(1, NewCol) = HeaderData
.Cells(NewRow, NewCol) = Data
NewCol = NewCol + 1
Else
'put data under an existing header
.Cells(NewRow, c.Column) = Data
End If
End With
NewRow = NewRow + 1
RowCount = RowCount + 1
Loop
End With

End Sub


"Doug" wrote:

I am exporting data from the web. I export unto a file called Zack's
Export.xlsm. From here I select the data that I want to put into another
.xlsm file table so that I can later sort the data. How can I pick and choose
the data by column headings? For example, it makes no sense to have relative
data that exports from the web in columns A and Z, when I can have them side
by side; A&B. I am guessing the best way to do this is by column heading
recognition? How can I do this? If I am going about it all wrong please tell
me?
--
Thank you!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 460
Default Exporting Data?

Thank you. I will work on adapting this to my needs this weekend.
--
Thank you!


"Joel" wrote:

the macro below copies data from sheet 1 to the correct column in sheet 2
like this

sheet1
Header Data
a 1
b 2
c 3
b 5

sheet2
a b c
1
2
3
5

Sub test()

Set sht1 = Sheets("Sheet1")
Set Sht2 = Sheets("Sheet2")

With Sht2
LastCol = .Rows(1, Columns.Count).End(xlToLeft).Column
NewRow = 2
End With
RowCount = 2
With sht1
Do While .Range("A" & RowCount) < ""
'data to copy from sheet 1
HeaderData = .Range("A" & RowCount)
Data = .Range("B" & RowCount)
With Sht2
'look for header in row 1 on sht 2
Set c = .Rows(1).Find(what:=HeaderData, _
LookIn:=xlValues, lookat:=xlWhole)
If c Is Nothing Then
'put data in new column
.Cells(1, NewCol) = HeaderData
.Cells(NewRow, NewCol) = Data
NewCol = NewCol + 1
Else
'put data under an existing header
.Cells(NewRow, c.Column) = Data
End If
End With
NewRow = NewRow + 1
RowCount = RowCount + 1
Loop
End With

End Sub


"Doug" wrote:

I am exporting data from the web. I export unto a file called Zack's
Export.xlsm. From here I select the data that I want to put into another
.xlsm file table so that I can later sort the data. How can I pick and choose
the data by column headings? For example, it makes no sense to have relative
data that exports from the web in columns A and Z, when I can have them side
by side; A&B. I am guessing the best way to do this is by column heading
recognition? How can I do this? If I am going about it all wrong please tell
me?
--
Thank you!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
exporting data Ernst Guckel[_4_] Excel Programming 0 February 12th 07 05:37 PM
Exporting data (Data Table) to Excel Vlash Excel Worksheet Functions 3 September 29th 06 09:52 PM
Exporting Data Ket Excel Worksheet Functions 0 March 24th 05 01:10 PM
Exporting data Govind[_3_] Excel Programming 0 December 27th 03 11:40 AM
Exporting Data..... Al Mackay Excel Programming 0 July 8th 03 06:46 PM


All times are GMT +1. The time now is 01:37 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"