Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Basic Excel Question

Hello

I hope someone can help with what I think is a basic excel
question .
The excel version I am working with is 8.0 . I need to match two
columns .

COLUMN A COLUMN C
ROW 1 MR-1001
ROW 2 500.00
ROW 3 MS-1002
ROW 4
ROW 5 725.25
ROW 6 MT-2004
ROW 7
ROW 8
ROW 9
ROW 10 925.00


What I need is the 500.00 in column c to be on the same row as
mr-1001 which is row 1 . 725.25 needs to be in row 3 to match up with
ms-1002 an finally
925.00 needs to be on row 6 to match up with mt-2004 . Nothing needs
moved out of the columns they are originally in . This report was
exported into excel from an accounting software program and the report
is approx. 600 pages long .

So hopefully someone can help me with this problem .

Sincerely Mason
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Basic Excel Question

Sub testit()
Dim i As Long, lngRows As Long, rngCell As Range

With Worksheets(1)
lngRows = .Cells(.Rows.Count, 3).End(xlUp).Row
If .Cells(1, 1) = "" Then i = .Cells(1, 1).End(xlDown).Row Else i =
1
Do Until i lngRows
If .Cells(i, 3) = "" Then
Set rngCell = .Cells(i, 3).End(xlDown)
.Cells(i, 3).Value = rngCell.Value
rngCell.Value = ""
End If
i = .Cells(i, 1).End(xlDown).Row
Loop
End With
End Sub

"MASON" wrote in message
om...
Hello

I hope someone can help with what I think is a basic excel
question .
The excel version I am working with is 8.0 . I need to match two
columns .

COLUMN A COLUMN C
ROW 1 MR-1001
ROW 2 500.00
ROW 3 MS-1002
ROW 4
ROW 5 725.25
ROW 6 MT-2004
ROW 7
ROW 8
ROW 9
ROW 10 925.00


What I need is the 500.00 in column c to be on the same row as
mr-1001 which is row 1 . 725.25 needs to be in row 3 to match up with
ms-1002 an finally
925.00 needs to be on row 6 to match up with mt-2004 . Nothing needs
moved out of the columns they are originally in . This report was
exported into excel from an accounting software program and the report
is approx. 600 pages long .

So hopefully someone can help me with this problem .

Sincerely Mason



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 153
Default Basic Excel Question

Sort of simple, but seems to work. It assumes you have no
more thatn 20000 rows of data, which youmay need to
change.

Have a Merry Christmas

Sub Macro1()
Do Until ActiveCell.Row = 20000
If ActiveCell.Value = "" Then
ActiveCell.Offset(1, 0).Range("A1").Select
Else
ActiveCell.Offset(0, 1).Select
returncell = ActiveCell.Address
Selection.End(xlDown).Select
Selection.Cut
Range(returncell).Select
ActiveSheet.Paste
ActiveCell.Offset(1, -1).Range("A1").Select
End If
Loop
Range("A1").Select
End Sub
-----Original Message-----
Hello

I hope someone can help with what I think is a

basic excel
question .
The excel version I am working with is 8.0 . I need

to match two
columns .

COLUMN A COLUMN C
ROW 1 MR-1001
ROW 2 500.00
ROW 3 MS-1002
ROW 4
ROW 5 725.25
ROW 6 MT-2004
ROW 7
ROW 8
ROW 9
ROW 10 925.00


What I need is the 500.00 in column c to be on

the same row as
mr-1001 which is row 1 . 725.25 needs to be in row 3 to

match up with
ms-1002 an finally
925.00 needs to be on row 6 to match up with mt-2004 .

Nothing needs
moved out of the columns they are originally in . This

report was
exported into excel from an accounting software program

and the report
is approx. 600 pages long .

So hopefully someone can help me with this problem .

Sincerely Mason
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Basic Excel Question

Try one of the following two options.

'Preserve spacing in Column A option
Sub Test()
Dim Rng1 As Range, Rng2 As Range
Dim C As Range, TempAr() As String
Dim i As Integer

Set Rng1 = Intersect(Columns("A"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants ))
Set Rng2 = Intersect(Columns("C"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants ))

For Each C In Rng2
i = i + 1
ReDim Preserve TempAr(i)
TempAr(i) = C.Value
Next
i = 0
For Each C In Rng1
i = i + 1
C.Offset(, 3) = C
C.Offset(, 5) = TempAr(i)
Next

Columns("A:C").Delete
End Sub

'Remove blanks in Columns A and C option
Sub Test2()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim i As Integer

Set Rng1 = Intersect(Columns("A"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants ))
Set Rng2 = Intersect(Columns("C"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants ))

For Each C In Rng1
i = i + 1
Cells(i, 4) = C
Next

Regards,
Greg
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Basic Excel Question

I did a sloppy copy and paste. Macro Test2 should be:

Sub Test2()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim i As Integer

Set Rng1 = Intersect(Columns("A"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants ))
Set Rng2 = Intersect(Columns("C"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstants ))

For Each C In Rng1
i = i + 1
Cells(i, 4) = C
Next

i = 0
For Each C In Rng2
i = i + 1
Cells(i, 6) = C
Next

Columns("A:C").Delete
End Sub

Regards,
Greg




-----Original Message-----
Try one of the following two options.

'Preserve spacing in Column A option
Sub Test()
Dim Rng1 As Range, Rng2 As Range
Dim C As Range, TempAr() As String
Dim i As Integer

Set Rng1 = Intersect(Columns("A"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))
Set Rng2 = Intersect(Columns("C"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))

For Each C In Rng2
i = i + 1
ReDim Preserve TempAr(i)
TempAr(i) = C.Value
Next
i = 0
For Each C In Rng1
i = i + 1
C.Offset(, 3) = C
C.Offset(, 5) = TempAr(i)
Next

Columns("A:C").Delete
End Sub

'Remove blanks in Columns A and C option
Sub Test2()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim i As Integer

Set Rng1 = Intersect(Columns("A"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))
Set Rng2 = Intersect(Columns("C"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))

For Each C In Rng1
i = i + 1
Cells(i, 4) = C
Next

Regards,
Greg
.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default Basic Excel Question

The lines where I specify the ranges for Rng1 and Rng2 are
better written as follows. I forgot that you can specify
a subset of the active sheet using SpecialCells. Correct
for word wrap.

Set Rng1 = ActiveSheet.Columns("A").SpecialCells
(xlConstants)
Set Rng2 = ActiveSheet.Columns("C").SpecialCells
(xlConstants)


Regards,
Greg

-----Original Message-----
I did a sloppy copy and paste. Macro Test2 should be:

Sub Test2()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim i As Integer

Set Rng1 = Intersect(Columns("A"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))
Set Rng2 = Intersect(Columns("C"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))

For Each C In Rng1
i = i + 1
Cells(i, 4) = C
Next

i = 0
For Each C In Rng2
i = i + 1
Cells(i, 6) = C
Next

Columns("A:C").Delete
End Sub

Regards,
Greg




-----Original Message-----
Try one of the following two options.

'Preserve spacing in Column A option
Sub Test()
Dim Rng1 As Range, Rng2 As Range
Dim C As Range, TempAr() As String
Dim i As Integer

Set Rng1 = Intersect(Columns("A"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))
Set Rng2 = Intersect(Columns("C"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))

For Each C In Rng2
i = i + 1
ReDim Preserve TempAr(i)
TempAr(i) = C.Value
Next
i = 0
For Each C In Rng1
i = i + 1
C.Offset(, 3) = C
C.Offset(, 5) = TempAr(i)
Next

Columns("A:C").Delete
End Sub

'Remove blanks in Columns A and C option
Sub Test2()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim i As Integer

Set Rng1 = Intersect(Columns("A"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))
Set Rng2 = Intersect(Columns("C"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))

For Each C In Rng1
i = i + 1
Cells(i, 4) = C
Next

Regards,
Greg
.

.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Basic Excel Question

"Greg Wilson" wrote in message ...
The lines where I specify the ranges for Rng1 and Rng2 are
better written as follows. I forgot that you can specify
a subset of the active sheet using SpecialCells. Correct
for word wrap.

Set Rng1 = ActiveSheet.Columns("A").SpecialCells
(xlConstants)
Set Rng2 = ActiveSheet.Columns("C").SpecialCells
(xlConstants)


Regards,
Greg

-----Original Message-----
I did a sloppy copy and paste. Macro Test2 should be:

Sub Test2()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim i As Integer

Set Rng1 = Intersect(Columns("A"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))
Set Rng2 = Intersect(Columns("C"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstant s))

For Each C In Rng1
i = i + 1
Cells(i, 4) = C
Next

i = 0
For Each C In Rng2
i = i + 1
Cells(i, 6) = C
Next

Columns("A:C").Delete
End Sub

Regards,
Greg




-----Original Message-----
Try one of the following two options.

'Preserve spacing in Column A option
Sub Test()
Dim Rng1 As Range, Rng2 As Range
Dim C As Range, TempAr() As String
Dim i As Integer

Set Rng1 = Intersect(Columns("A"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))
Set Rng2 = Intersect(Columns("C"), _
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))

For Each C In Rng2
i = i + 1
ReDim Preserve TempAr(i)
TempAr(i) = C.Value
Next
i = 0
For Each C In Rng1
i = i + 1
C.Offset(, 3) = C
C.Offset(, 5) = TempAr(i)
Next

Columns("A:C").Delete
End Sub

'Remove blanks in Columns A and C option
Sub Test2()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim i As Integer

Set Rng1 = Intersect(Columns("A"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))
Set Rng2 = Intersect(Columns("C"),
ActiveSheet.Cells.SpecialCells(xlCellTypeConstan ts))

For Each C In Rng1
i = i + 1
Cells(i, 4) = C
Next

Regards,
Greg
.

.

I want to say thank you to all that posted solutions . You have been very helpful .

Sincerely Mason
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
Very basic VBA question. Cerberus Excel Discussion (Misc queries) 1 July 21st 08 04:30 PM
basic question M121385 New Users to Excel 4 May 6th 08 06:22 PM
Basic question...sorry jen the runner Excel Worksheet Functions 11 September 18th 07 12:12 AM
Simple for you, tough for me, basic excel question cup0spam Excel Discussion (Misc queries) 1 May 31st 05 06:10 AM
Basic Question of Excel Neil Greenough Excel Programming 7 October 4th 03 02:54 AM


All times are GMT +1. The time now is 09:13 PM.

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

About Us

"It's about Microsoft Excel"