Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-28-2014, 01:29 PM
bremen22 bremen22 is offline Row Looks to be blank but its not Windows 7 64bit Row Looks to be blank but its not Office 2010 64bit
Advanced Beginner
Row Looks to be blank but its not
 
Join Date: Jul 2013
Posts: 44
bremen22 is on a distinguished road
Default Row Looks to be blank but its not

I have a workbook that I use to reformat data from its original format into the format I want.



In that workbook there is a macro that deletes all of the blank rows on the main sheet

Code:
Sub delblankrows()

Dim s1 As Worksheet
Dim tmpR As Range
Dim rowcount As Long, colcount As Long, i As Long, j As Long, k As Boolean

'Change "Sheet1" to the name of your worksheet.
Set s1 = Sheets("sheet1")
Set tmpR = s1.UsedRange
rowcount = tmpR.Rows.Count
colcount = tmpR.Columns.Count

'Starts from bottom row and looks for non-empty cells from left to right.
'Moves to row above if non-empty cell is found.
'If none is found, then deletes row and shifts values up.
For i = rowcount To 1 Step -1
    k = 0
    For j = 1 To colcount
        If tmpR.Value2(i, j) <> "" Then
            k = 1
            Exit For
        End If
    Next j
I have used this line of code in numerous other sheets and it works fine. In this book, however, there are rows that appear empty but when I run the macro those do not get deleted.

When I select the row and "clear contents" and run the macro again the row gets deleted.

I dont even know where to start figuring this one out....
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
won't show blank cell bhum Excel 2 01-28-2014 02:34 AM
Row Looks to be blank but its not Document comes up as a blank Grover Word 1 11-29-2013 07:24 PM
Page numberring 1 - blank - 2 - blank etc Intern PowerPoint 0 09-02-2011 01:16 AM
hidden blank pages mljm Word 3 06-19-2009 03:18 AM
Row Looks to be blank but its not How to turn all blank lines into non-blank for legal forms sieler Word 3 04-12-2009 01:38 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:17 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft