I need to fetch where the table starts in Excel ( that’s not an exact table in Excel, it looks like table format, and I can recognize it by column heading). so I need to remove all other info in Excel expect that table.
after identifying i need to take all columns heading alone for checking.
I need a cell number from active excel cell but it can’t get it.
I think that file has many headers above and the data that needs to be retrieved below
We’ll read the whole thing first
Then find the location where the data starts and read it again from here
Could you share file, I will code in detail
regards,
as i am new to forum, i am forbidden to share my file here. Yes, ur screenshot exactly correct matches mine. but there is no space after column name, there may be full blank column inside sometimes. but column starts some distance from start of page thats right as urs. Here is te sample excel file. i need that table values alone without any white space. I need all column headings separartely to check missed heading in file in exception scenorio ecl.xlsx (34.6 KB)
I see
If it’s private you can send me in message if you want code in detail.
In here, we will read all file to get data table call is dt
then use for each row in dt find row header which we need get index → call this is index
then read file again from the index above
we will have data what we need get
eg: with your file, we can find index is 9
regards,
intRowIndex = -1
For Each Row in dtFullSheet (Output: rowIndex)
If condition to identify the start of the table
intRowIndex = rowIndex
Break
End If
Next
If intRowIndex > -1
Delete Range (Range: "A1:A" + (intRowIndex-1).ToString)
Delete Range (Range: "A" + (intRowIndex+yourTableHeight).ToString + ":End")
Read Range (Range: "A" + intRowIndex.ToString, Output: dtColumnHeadings)
For Each column in dtColumnHeadings.Columns
// Process column names
Next
End If
// To get the active cell address if Get Active Cell activity is not working
Invoke VBA (Code: yourMacroCode, MethodName: "GetActiveCellAddress")