How can i read a specific coloumn values and get its contents?

  • Thread starter Thread starter vidhya
  • Start date Start date
V

vidhya

Hi,

Can anyone plz tell me how to read a specific column values and get its
contents.
I managed to read the specific sheet tat i want and now i need to get the
first column values and also first column count..... and get its contents...

I dont want to use oledb, ie reading from database.. i checked some posts,
but all those are reading database... i dont want it....
 
There are a lot of ways. To read cell contents. Here is one:

Sub readValsInCol()

Const myColumn = "A"
'Change to "B" "C", "D", "AB" etc
'depending which column you wish to check
' If you need to read more columns you need
' to change code

strt = ActiveSheet.UsedRange.Row
'gives first row of the used range

fin = ActiveSheet.UsedRange.Rows.Count
'gives number of rows in the used range

For i = strt To fin
'loop through rows of the used range
myval = Range(myColumn & i).Value
Debug.Print myval ' do what you wish here
Next i

End Sub
 
Back
Top