Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Triston
An 'area' is a single block of one or more cells in the selection. If the selection is a single cell it also has one area and the area contains the single cell. can't work out how your macro cycles through the single cells. It doesn't, it loops through areas, which may or may not be a single cell. 'ar' is an area, an area is a range. The other problem you had was assigning values in a range to a variant. If the range is a single cell the variant holds the value, it doesn't become an array. But if you assign to a block of cells the variant becomes an array of values same size as the block. To ensure the variant is also an array when dealing with a single cell first make it an array 1x1 array (with base 1), that's what the ReDim does. Then assign the only element in the array with cell value. The only reason for doing that is for consistency when it comes to processing later on (though I probably wouldn't do it that way myself). I'm sure if you sit in the darkened room long enough the light will shine! Regards, Peter T 'ar' is a range which gets assigned to each area (block of one or more cells) "Tristan" wrote in message ... Hi Peter I've used your code and it does exactely what I was trying to do thuogh I freely admit I don't quite know why. I haven't come across using the areas collection before and I'm still can't work out how your macro cycles through the single cells. What is "ar" exactly? It's dimmed as a range but is never assigned a range as far as I can make out. It has a count property...is it a collection within the rng.areas collection??? hmmm. Maybe ar stands for array. I'm going to have to go and sit in a darkened room to think about it. Huge thanks however, I was never going to be able to work this one by myself. Ta, Tris -- Tristan ------------------------------------------------------------------------ Tristan's Profile: http://www.excelforum.com/member.php...o&userid=34061 View this thread: http://www.excelforum.com/showthread...hreadid=541967 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Add Permission did not work in "Allow User to Edit Ranges" | Excel Discussion (Misc queries) | |||
Delete non-contiguous selected rows | Excel Programming | |||
summing non contiguous ranges | Excel Discussion (Misc queries) | |||
Adding Non-Contiguous Ranges | Excel Discussion (Misc queries) | |||
Delete a selected area from a non-contiguous range | Excel Programming |