ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to select only cells containing values within named range (https://www.excelbanter.com/excel-programming/420451-macro-select-only-cells-containing-values-within-named-range.html)

Code Numpty

Macro to select only cells containing values within named range
 
I have data in 5 columns and a maximum of 12 rows. This is a named range.

Rows will always be complete with data in each column but some rows at the
top and/or bottom of the range will contain formulas resulting in no value
("").

I need to be able to select the rows within the named range that result in
values only, in able to paste them as values elsewhere within the spreadsheet.

Is this possible?

royUK[_52_]

Macro to select only cells containing values within named range
 

Maybe, change MyRange to your range name


Code:
--------------------
Range("MyRange").SpecialCells(xlCellTypeConstants)
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33275


Code Numpty

Macro to select only cells containing values within named rang
 
Thanks Roy I was able to use that and get exactly what I need.

"royUK" wrote:


Maybe, change MyRange to your range name


Code:
--------------------
Range("MyRange").SpecialCells(xlCellTypeConstants)
--------------------


--
royUK

Hope that helps, RoyUK
For tips & examples visit my 'web site
' (http://www.excel-it.com)
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=33275




All times are GMT +1. The time now is 02:10 PM.

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