By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,720 Members | 2,095 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,720 IT Pros & Developers. It's quick & easy.

HOW TO COUNT DATA in MSFlexgrid

P: 12
i have import excel data in MSflexgrid.. Now i want to count the data for particulars fields...

Like Data have four column A, B, C and D
while using A column, i have to calculate the data of B column..
plz give me .. code for this...

Thanx
Apr 9 '07 #1
Share this Question
Share on Google+
4 Replies


Dököll
Expert 100+
P: 2,364
i have import excel data in MSflexgrid.. Now i want to count the data for particulars fields...

Like Data have four column A, B, C and D
while using A column, i have to calculate the data of B column..
plz give me .. code for this...

Thanx
Hello uprakash14!

You've come to the right place, you'll have to tell us a little more. Do you have anything working this very minute. You can help avoid confusion if your code is posted, especially in the event one needs to post a tutorial to help you figure this all out.

Please stay tuned and good luck.
Apr 10 '07 #2

P: 12
Hello uprakash14!

You've come to the right place, you'll have to tell us a little more. Do you have anything working this very minute. You can help avoid confusion if your code is posted, especially in the event one needs to post a tutorial to help you figure this all out.

Please stay tuned and good luck.

i am doing work with excel .. i have imported excel file in MSflexgrid... Now i have prob is that i have to count the records. or we can say that .. count the cells of that excel file. using diff colunm taking into consideration...

thanx
Apr 10 '07 #3

Dököll
Expert 100+
P: 2,364
i am doing work with excel .. i have imported excel file in MSflexgrid... Now i have prob is that i have to count the records. or we can say that .. count the cells of that excel file. using diff colunm taking into consideration...

thanx
Splendid, this means you have a working code. Mind posting it!

You will get better, sound results that way...
Apr 15 '07 #4

100+
P: 375
i am doing work with excel .. i have imported excel file in MSflexgrid... Now i have prob is that i have to count the records. or we can say that .. count the cells of that excel file. using diff colunm taking into consideration...

thanx
This is not my code but try it out(or you can modify)
=======
Here is a function that accepts a grid control and a column number. It then
totals all the rows of the column and returns the total in the name of the
function. You can probably use or modify this code to do what you need:


Public Function getGridColumnTotal(myGrid As Control, myColumn As Long) As
Single


'Calculate and return the total of all the cells in a grid's column.
'The grid to use is passed into the function as myGrid.
'The column to use is passed into the funcion as myColumn.


Dim counter As Integer, myTotal As Single, myCell As Single


'turn on an error handler
On Error GoTo getGridColumnTotalError


'set the grid's column to the argument passed into the function
myGrid.Col = myColumn


'loop through all the items in the grid
For counter = 0 To myGrid.Rows - 1
'set the grid's row to the counter
myGrid.Row = counter
'if the text in the current cell is numeric
If IsNumeric(myGrid.Text) Then
'retrieve the current cell (pointed to by the grid's Row and Col
properties
myCell = myGrid.Text
'add the cell's contents to a running total
myTotal = myTotal + myCell
End If
Next counter
'return the grid column's total in the name of the function
getGridColumnTotal = myTotal


'exit to keep from falling into the error handler
Exit Function
getGridColumnTotalError:
'use a message box to indicate an error number and error description
MsgBox Err & Error, vbCritical, "getGridColumnTotal Error"


End Function
Apr 16 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.