Thread: Data Adjustment
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] prasad.vanka@computershare.co.uk is offline
external usenet poster
 
Posts: 6
Default Data Adjustment

Thanks Guys for all the answers.

Regards
Prasad Vanka


sbakker wrote:
Well this is how I would do it quick and dirty ;)


Code:
--------------------
Sub RmvBlanks()
Dim rngMyRange As Range
Dim rngCurRow As Range
Dim lCount, lInnerCount As Long
Dim lColumns As Long


Set rngMyRange = Selection
lColumns = rngMyRange.Columns.Count
'Loop through each row of selection
For Each rngCurRow In rngMyRange.Rows
lInnerCount = 1
'Loop through each column of the current row
For lCount = 1 To lColumns
'If Cell is no empty copy the value to the next open cell from the

left
If rngCurRow.Columns(lCount) < vbNullString Then
rngCurRow.Columns(lInnerCount) = rngCurRow.Columns(lCount)
If lInnerCount < lCount Then
rngCurRow.Columns(lCount) = ""
End If
lInnerCount = lInnerCount + 1
End If
Next lCount
Next rngCurRow
End Sub
--------------------


--
sbakker

------------------------------------------------------------------------
sbakker's Profile:

http://www.excelforum.com/member.php...o&userid=23645
View this thread:

http://www.excelforum.com/showthread...hreadid=373072