#1   Report Post  
Max
 
Posts: n/a
Default Flat File

I need help, I have an excel file that has Prov. Nums, Addresses,
and specialties, in multi-rows. I need to move the Addresses and Specialty
rows to be columns reflecting the Prov. Num.
For example:

Provider Num Address Specialty
125126 360 95th Internaml Medicine
125126 320 85th Cardiology

Change to:

Provider Num Address1 Specialty1 Address2 Specialty2
125126 360 95th Internaml Medicine 320 85th Cardiology
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Max,

Here is one way

Dim cLastRow As Long
Dim i As Long
Dim rng As Range

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("D1").Value = "Address 2"
Range("E1").Value = "Speciality 2"
For i = 2 To cLastRow Step 2
Cells(i + 1, "B").Resize(1, 2).Cut Destination:=Cells(i, "D")
If rng Is Nothing Then
Set rng = Cells(i + 1, "B").Resize(1, 2)
Else
Set rng = Union(rng, Cells(i + 1, "B").Resize(1, 2))
End If
Next i
If Not rng Is Nothing Then
rng.EntireRow.Delete
End If


--
HTH

-------

Bob Phillips
"Max" wrote in message
...
I need help, I have an excel file that has Prov. Nums, Addresses,
and specialties, in multi-rows. I need to move the Addresses and Specialty
rows to be columns reflecting the Prov. Num.
For example:

Provider Num Address Specialty
125126 360 95th Internaml Medicine
125126 320 85th Cardiology

Change to:

Provider Num Address1 Specialty1 Address2

Specialty2
125126 360 95th Internaml Medicine 320 85th Cardiology



  #3   Report Post  
Max
 
Posts: n/a
Default

Should I put this in a macro, or where? Thanks

"Bob Phillips" wrote:

Max,

Here is one way

Dim cLastRow As Long
Dim i As Long
Dim rng As Range

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("D1").Value = "Address 2"
Range("E1").Value = "Speciality 2"
For i = 2 To cLastRow Step 2
Cells(i + 1, "B").Resize(1, 2).Cut Destination:=Cells(i, "D")
If rng Is Nothing Then
Set rng = Cells(i + 1, "B").Resize(1, 2)
Else
Set rng = Union(rng, Cells(i + 1, "B").Resize(1, 2))
End If
Next i
If Not rng Is Nothing Then
rng.EntireRow.Delete
End If


--
HTH

-------

Bob Phillips
"Max" wrote in message
...
I need help, I have an excel file that has Prov. Nums, Addresses,
and specialties, in multi-rows. I need to move the Addresses and Specialty
rows to be columns reflecting the Prov. Num.
For example:

Provider Num Address Specialty
125126 360 95th Internaml Medicine
125126 320 85th Cardiology

Change to:

Provider Num Address1 Specialty1 Address2

Specialty2
125126 360 95th Internaml Medicine 320 85th Cardiology




  #4   Report Post  
Max
 
Posts: n/a
Default

I put is in VB Editior, and it gives me an error in the line (xlUp). Please
advise, I appreciated it.

"Max" wrote:

I need help, I have an excel file that has Prov. Nums, Addresses,
and specialties, in multi-rows. I need to move the Addresses and Specialty
rows to be columns reflecting the Prov. Num.
For example:

Provider Num Address Specialty
125126 360 95th Internaml Medicine
125126 320 85th Cardiology

Change to:

Provider Num Address1 Specialty1 Address2 Specialty2
125126 360 95th Internaml Medicine 320 85th Cardiology

  #5   Report Post  
Max
 
Posts: n/a
Default

It worked Thanks

"Bob Phillips" wrote:

Max,

Here is one way

Dim cLastRow As Long
Dim i As Long
Dim rng As Range

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("D1").Value = "Address 2"
Range("E1").Value = "Speciality 2"
For i = 2 To cLastRow Step 2
Cells(i + 1, "B").Resize(1, 2).Cut Destination:=Cells(i, "D")
If rng Is Nothing Then
Set rng = Cells(i + 1, "B").Resize(1, 2)
Else
Set rng = Union(rng, Cells(i + 1, "B").Resize(1, 2))
End If
Next i
If Not rng Is Nothing Then
rng.EntireRow.Delete
End If


--
HTH

-------

Bob Phillips
"Max" wrote in message
...
I need help, I have an excel file that has Prov. Nums, Addresses,
and specialties, in multi-rows. I need to move the Addresses and Specialty
rows to be columns reflecting the Prov. Num.
For example:

Provider Num Address Specialty
125126 360 95th Internaml Medicine
125126 320 85th Cardiology

Change to:

Provider Num Address1 Specialty1 Address2

Specialty2
125126 360 95th Internaml Medicine 320 85th Cardiology




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
Creating a PDF file programatically from Excel Chaplain Doug Excel Discussion (Misc queries) 0 December 16th 04 08:49 PM
File asks to update when no links were created Dave Links and Linking in Excel 1 December 16th 04 08:10 PM
File is locked for Editing by user problem Mirth Excel Discussion (Misc queries) 1 December 3rd 04 04:45 PM
format question when open csv file Jeff Excel Discussion (Misc queries) 1 December 1st 04 06:53 PM
Convert text file to MS_Excel Aqua Flow Excel Discussion (Misc queries) 1 November 30th 04 02:55 AM


All times are GMT +1. The time now is 02:30 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"