LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 536
Default Eliminate blanks while copy row and transpose

Each row in the C3:C10 range has various number of columns, and a few blanks in each row, arbitrary across row.

Want to copy and transpose each row, minus the blank cells to sheet 2.

I am happy with either the sheet 2 destination as Column A .xlup.offset(1,0) OR each copied row to a separate adjacent column on sheet 2.

This code below works "kinda okay" to copy and transpose on the same sheet.

I have tried to use Autofilter to "hide" the blanks in place and copy and transpose only the remaining row data to sheet 2, then turn Autofilter off to retain original data as was, blanks and all.

Lost of advice about Autofilter on columns, but cannot find something useful dealing with blanks in a row.

Thanks.
Howard

Option Explicit

Sub BlankOutSheet()
Dim c As Range, Rng As Range
Dim PnRow As String
Dim lCol As Long
Dim cRow As Long

PnRow = Range("C1")

For Each c In Range("C3:C10")
If c = PnRow Then

cRow = c.Row
lCol = Cells(cRow, Cells.Columns.Count).End(xlToLeft).Column

On Error Resume Next
c.Resize(1, lCol).Copy
Range("C" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial _
xlPasteValues, Transpose:=True
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Delete Shift:=xlUp
Application.CutCopyMode = False
End If
Next

End Sub
 
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
transpose skip 0's and blanks ali Excel Programming 3 July 20th 07 02:19 AM
transpose without 0's and blanks ali Excel Discussion (Misc queries) 2 July 19th 07 02:20 AM
Transpose and remove blanks KarenB Excel Programming 1 January 31st 07 05:24 PM
eliminate blanks from listbox rowsource Jacob Excel Programming 3 November 1st 06 06:45 PM
Eliminate blanks before a charachter chain MónicaM[_2_] Excel Programming 2 April 22nd 06 03:26 AM


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