Hi all,

I'm working on Windows fom application in vb.net. I want to get the hidden rows and columns in an excel file and make them visable and also delete few of them.

I have written the below code, but it doesn't do what i wanted to do. Not sure where i'm wrong.
Code:
 Dim lastRow As Integer
                    Dim lastColumn As Integer

                    For lastRow = 1 To rng.Rows.Count
                        For lastColumn = 1 To rng.Columns.Count
 lastColumn = +lastColumn
                        Next
                        lastRow = +lastRow
                    Next


 For lp = lastColumn To 1 Step -1 'loop through all columns
                        If oWorksheet.Columns(lp).EntireColumn.Hidden = True Then
                            oWorksheet.Columns(lp).EntireColumn.Delete()
                        End If
                    Next
                    For lp = lastRow To 1 Step -1 'loop through all rows
                        If oWorksheet.Rows(lp).EntireRow.Hidden = True Then
                            oWorksheet.Rows(lp).EntireRow.Delete()
                        End If
                    Next
Thanks in advance.