LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default distinguish Range and "Single"


Hi,

I have to do different things ([BLOCK 1] and [BLOCK 2]) if Z is a
"Single" (a number or a Range of 1x1) or if Z is a Range (a genuine, not
1x1). My workaround is like

If TypeOf Z Is Range Then
If (Z.Rows.Count=1) And (Z.Columns.Count=1) Then
[Block 1]
Else
[Block 2]
End If
Else
[Block 1]
End If


but I don't like it: [Block 1] two times and the construction
'(Z.Rows.Count=1) And (Z.Columns.Count=1)' seems to be ugly.

I guess that this problem appears frequently.
What would be a good solution?

 
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
How to distinguish zeros ("0") from blank cells? Clay888 Excel Worksheet Functions 3 October 30th 07 07:12 PM
Multiple "source" workbooks linked to single "destination" workboo DAVEJAY Excel Worksheet Functions 1 September 17th 07 05:33 PM
Change data in a single column from "last, first" to "first last" Jeanne Excel Discussion (Misc queries) 2 March 27th 06 08:40 PM
Copy column range of "single word" cells with spaces to a single c nastech Excel Discussion (Misc queries) 3 February 15th 06 05:04 PM
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" Luc[_3_] Excel Programming 2 September 28th 05 08:37 PM


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

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"