Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Finding Non-Blank Cells

Hi,

Excel has an inbuilt Specialcells method that finds Blank cells. Would there be a quick (quick as in Specialcells speed) way to assign a Non-Blank range without having to loop through every cell within the Usedrange and do the IsEmpty test?

Thanks in advance,

SuperJas.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Finding Non-Blank Cells

Superjas

The following will select any formulas and constants.
Union(Cells.SpecialCells(xlCellTypeFormulas),
Cells.SpecialCells(xlCellTypeConstants)).Select

Tony
-----Original Message-----
Hi,

Excel has an inbuilt Specialcells method that finds Blank

cells. Would there be a quick (quick as in Specialcells
speed) way to assign a Non-Blank range without having to
loop through every cell within the Usedrange and do the
IsEmpty test?

Thanks in advance,

SuperJas.

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Finding Non-Blank Cells

Just note that it will cause an error if you have all constants or all
formulas in your non-blank cells.

--
Regards,
Tom Ogilvy


"acw" wrote in message
...
Superjas

The following will select any formulas and constants.
Union(Cells.SpecialCells(xlCellTypeFormulas),
Cells.SpecialCells(xlCellTypeConstants)).Select

Tony
-----Original Message-----
Hi,

Excel has an inbuilt Specialcells method that finds Blank

cells. Would there be a quick (quick as in Specialcells
speed) way to assign a Non-Blank range without having to
loop through every cell within the Usedrange and do the
IsEmpty test?

Thanks in advance,

SuperJas.

.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Finding Non-Blank Cells

This is how i approached a similar problem

Sub CopyDown(ByVal intCol As Integer, ByVal intStartRow As Integer)
'Macro for Copying Information down to blank cells
'From Data from Pivot Tables
'Written by DC on 15/01/2004

Dim dblLastRow As Double, dblRow1 As Double, dblrow2 As Double
Dim intMyRow As Integer
Dim strMyRange As String, StrMyText As String

dblLastRow = Range("A" & Rows.Count).End(xlUp).Row
dblrow2 = intStartRow

Do Until Cells(dblrow2, intCol).Row dblLastRow
dblRow1 = dblrow2
StrMyText = Cells(dblRow1, intCol).Formula

dblrow2 = Cells(dblRow1, intCol).End(xlDown).Offset(-1, 0).Row
If Cells(dblrow2, intCol).Formula = "" And dblrow2 <
dblLastRow Then
Range(Cells(dblRow1, intCol), Cells(dblrow2
intCol)).Formula = StrMyText
dblrow2 = dblrow2 + 1
ElseIf dblrow2 dblLastRow Then
dblrow2 = dblLastRow - 1
If Cells(dblrow2, intCol).Formula = "" Then
Range(Cells(dblRow1, intCol), Cells(dblrow2
intCol)).Formula = StrMyText
dblrow2 = dblrow2 - 1
End If
Exit Do
Else
dblrow2 = dblrow2 + 1
End If
Loop
End Sub

I passed two arguments in the inital instance one for the start row an
one for the start column

Hope this Helps

Davi

--
Message posted from http://www.ExcelForum.com

Reply
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
Finding Next Blank Cell in Blank Row Nick Wakeham Excel Worksheet Functions 3 June 11th 08 02:15 PM
Finding next non-blank cell Stu[_2_] Excel Discussion (Misc queries) 4 October 23rd 07 01:29 PM
Finding blank cells scorpiorc Excel Discussion (Misc queries) 10 December 7th 06 06:27 PM
Finding the first blank or zero value AAMIFC Excel Worksheet Functions 1 July 15th 05 04:36 AM
finding blank cells in a row in Excel 97 Paul Herzig Excel Programming 2 August 5th 03 11:49 AM


All times are GMT +1. The time now is 05:27 AM.

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"