Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
to count the number of used rows in a particular column
#1
Not Solved
hi,
I have an excel sheet with different values for different columns
The used row count for each column is diffrent.

Can I get the used range count for a particular colum say eg:Column C.
I need to set this value as the limit for my For loop.

I tried the below but is useless as usedrange always returns the longest columns row count

Code:
Set Excel=createobject("excel.application")

Excel.visible = True
Set wkb = Excel.Workbooks.Open("D:\report period.xls")
Set ws = wkb.Sheets(1)
p=ws.UsedRange.Rows.Count
Reply
#2
Not Solved
Used the below LOC long back... checkout and let me know if you need any help

Code:
intLastRow = Cells(Cells.Rows.Count,"A").End(xlUp).Row
OR
intEndRow = Cells(ActiveSheet.UsedRange.Rows.Count+1,ActiveCell.Column).End(xlUp).Row
Thanks,
SUpputuri
Reply
#3
Not Solved
Itried both as below.But shows run time error Sad

Code:
intLastRow = Cells(ActiveSheet.Rows.Count,"A").End(xlUp).Row
OR
Code:
intEndRow = Cells(ActiveSheet.UsedRange.Rows.Count+1,ActiveCell.Column).End(xlUp).Row
--------------------------------------------------------------------------------
Reply
#4
Not Solved
used
rowcount= ws.Range("A65536").End(xlUp).Row also

didnt work
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  does WebTable Object provides a method to get column number umer830 4 13,045 07-06-2018, 09:32 AM
Last Post: vijaychourasiya0109@gmail.com
  How to Delete Rows with duplicate values in 1 columns in excel thru QTP. arpan 0 2,850 02-09-2015, 08:47 PM
Last Post: arpan
  How to get center data value in a odd number of rows and columns web table ... sai rajesh 0 2,836 11-13-2013, 10:24 PM
Last Post: sai rajesh
  Problem with Multiple rows retrieval from mySQL and save it some variable Dejavu 1 2,175 03-15-2013, 02:52 PM
Last Post: basanth27
  Wrong count for UsedRange rows and columns in datatable. qtpexpert 2 6,434 06-20-2012, 04:35 PM
Last Post: qtpexpert

Forum Jump:


Users browsing this thread: 2 Guest(s)