Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transferring Data from one Excel sheet to another

Status
Not open for further replies.

ipalomeque

Technical User
Feb 21, 2001
3
US
I am a beginner in VB. If anyone can help me code to solve the following problem. I have Data on one excel sheet, and I want to transfer it to another excel sheet in an organized manner. The data on sheet 1 is as follows:

Lot Wandin Begin Stop Wand Out
1 10.20
1 10.25
1 18.24
1 19.25
2 15.24
2 18.26
3 14.25
3 15.26

I want to transfer it to another sheet to look read like this (combine multiple lines into 1):
Lot Wandin Begin Stop Wand Out
1 10.20 10.25 18.24 19.25
2 15.24 18.26
3 14.25 15.26

As you can see I am really a beginner, and I need all the help I can get. I have excellent programming algorithm experience in Pascal(does it still exist??). So, any help would be greatly appreciated.
Thanks in Advance,
Isaias Palomeque
 
Try something like this (it works in Excel):

Dim x As Integer, y As Integer, RowNum As Integer
Dim SomeValue As Single

x = 2
y = 2

Do While Cells(x, 1).Value <> &quot;&quot;
RowNum = Cells(x, 1).Value
For y = 2 To 5
If Cells(x, y).Value <> &quot;&quot; Then
SomeValue = Cells(x, y).Value
Exit For
End If
Next y
Sheets(&quot;Sheet2&quot;).Cells(RowNum + 1, 1).Value = RowNum
Sheets(&quot;Sheet2&quot;).Cells(RowNum + 1, y).Value = SomeValue
x = x + 1
Loop
Colin Chevrier
colin.chevrier@ca.jdsuniphase.com

 
Alternatively, you could use the VB Macro inside the Excell. By recording the things you've worked on excell there's a corresponding VB macro when you enable it. Save, and look for the VB code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top