ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   TRANSPOSE WITHOUT ZEROES(0's) (https://www.excelbanter.com/excel-programming/393607-transpose-without-zeroes-0s.html)

ali

TRANSPOSE WITHOUT ZEROES(0's)
 
Hi gurus,

Could someone help sort this out. I am using the following code to
transpose rows into columns, skipping blanks. (thanks to gary) Can I
add something to it to skip zeroes as well. I want the code to
transpose all non-zero values but leave no gaps in column.

For example: 123404
would be 12344

Public Sub wede()
Dim lastcol As Long
Dim ws As Worksheet
Set ws = Worksheets("SHEET1")
lastcol = ws.Cells(17, Columns.Count).End(xlToLeft).Column
With ws
..Range(.Cells(17, 1), .Cells(17,
lastcol)).SpecialCells(xlCellTypeConstants).Copy
..Range("A150").PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, _
SkipBlanks:=False,Transpose:=True
End With
Application.CutCopyMode = False
End Sub

Could somebody help please.



All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com