LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 
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 05:40 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"