Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have the following code: Code ------------------- Dim numPet As Integer Dim sel ' what kind of object is this... so i can use count... "range", "application.selection" don't work Worksheets("Datos").Activate sel = Excel.Range("A4", Excel.Range("A4").End(xlDown)).Select numPet = sel.Rows.Count ------------------- and I need to count the number of rows selected. as there will be n blank cells counting like this should be fine. but i don't know what kind of objec "sel" needs to be. btw. any idea on how to apply a filter (select only cell containing certain string) on the selection -- Acid-Sk ----------------------------------------------------------------------- Acid-Sky's Profile: http://www.excelforum.com/member.php...fo&userid=2650 View this thread: http://www.excelforum.com/showthread.php?threadid=39806 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Acid-Sky
I am using code like Dim iRows As Integer Worksheets("Datos").Activate iRows = Excel.Range("A4", Excel.Range("A4").End(xlDown)).Rows.Count to count the number of rows. If you would like to do something with this range try Dim rPart As Range Dim iRows As Integer Worksheets("Datos").Activate rPart = Excel.Range("A4", Excel.Range("A4").End(xlDown)) iRows = rPart.Rows.Count I hoop this is the answer |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Acid-Sky
I am using code like Dim iRows As Integer Worksheets("Datos").Activate iRows = Excel.Range("A4", Excel.Range("A4").End(xlDown))*.Rows.Count to count the number of rows. If you would like to do something with this range try Dim rPart As Range Dim iRows As Integer Worksheets("Datos").Activate Set rPart = Excel.Range("A4", Excel.Range("A4").End(xlDown)) iRows = rPart.Rows.Count a range is a complex item in Excel so you must use the Set commend. I hoop this is the answer |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() This code works Code: -------------------- Sub count() Dim numPet As Integer Dim sel As Range ' what kind of object is this... so i can use count... "range", "application.selection" don't work Worksheets("Datos").Activate Set sel = Excel.Range("A4", Excel.Range("A4").End(xlDown)) numPet = sel.Rows.count End Sub -------------------- -- instruite I am B.E. Instrumentation and Control and write now working as Hardware design engineer in automotive electrconics industry ------------------------------------------------------------------------ instruite's Profile: http://www.excelforum.com/member.php...o&userid=26539 View this thread: http://www.excelforum.com/showthread...hreadid=398066 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
dialog box selection type | Excel Discussion (Misc queries) | |||
Object Selection | Excel Discussion (Misc queries) | |||
Copy Selection - Transpose Selection - Delete Selection | Excel Discussion (Misc queries) | |||
Object Variable Not Set Error on Selection object | Excel Worksheet Functions | |||
How to find what object type is returned from Selection property ? | Excel Programming |