|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What Type of a cell in an Excell SpreadsheetHello,
I have opened an excel file into a .net application and any trying to determine if column 1 is a checkbox or not. Spreadsheet column 1 has both Text and Checkboxes. This is what I have tried to far with no success: For Lines = 1 To xlSht.Cells.Rows.Count xlRng = xlSht.Cells(Lines, 1) If xlRng.Value.GetType is boolean Then xlRng = xlSht.Cells(Lines, 2) End If Next Actually I have tried lots of different ways to determine this and have run out of ideas, Any assistance will be greatly appreciated. Thanks, Chuck Hi,
You did not postr enough information about this matter, but I have two general Ideas: If you are using the cell format to define the cell type, you can check the NumberFormat property of the cell. If you are using checkboxes, you can either bind them to a cell or not. Then you can go over the Shapes collection of the active sheet, and check if a certain check box is found in the column (by comparing the position of the column - using the left property, and the checkbox position). In General, the best way to learn Excel, is to record a macro of what you are trying to accomplish and them check what code was writen by the Excel. If you want you can post some more details, so I can try to figure out a more specific solution to your problem. Good Luck -- Show quoteGuyBar "Charles A. Lackman" wrote: > Hello, > > I have opened an excel file into a .net application and any trying to > determine if column 1 is a checkbox or not. Spreadsheet column 1 has both > Text and Checkboxes. This is what I have tried to far with no success: > > For Lines = 1 To xlSht.Cells.Rows.Count > xlRng = xlSht.Cells(Lines, 1) > If xlRng.Value.GetType is boolean Then > xlRng = xlSht.Cells(Lines, 2) > End If > Next > > Actually I have tried lots of different ways to determine this and have run > out of ideas, Any assistance will be greatly appreciated. > > Thanks, > Chuck > > > |
|||||||||||||||||||||||