StuartDwight
Registered User.
- Local time
- Today, 08:56
- Joined
- Mar 22, 2001
- Messages
- 12
I have some code below which opens a file in excel and gets a cell value.
What has happened is the file I am looking in changed and can contain a varying no of rows before the row I want.
What I need to do now is find the cell reference that contains a text string "Total Net Pay:", then I know the value I want will be in the next column on that row.
Has anyone got the code I would need that would give me the cell reference.
Thanks in advance,
Stu.
'Start of my code
Dim appExcel As Excel.Application
Dim xlWB As Excel.Workbook
Dim curNetPay As Currency
Set appExcel = New Excel.Application
Set xlWB = appExcel.Workbooks.Open("W:\my.csv")
With xlWB
.Worksheets(1).Select
curNetPay = .ActiveSheet.Range("E24").Value
End With
xlWB.Close
appExcel.Quit
Set xlWB = Nothing
Set appExcel = Nothing
What has happened is the file I am looking in changed and can contain a varying no of rows before the row I want.
What I need to do now is find the cell reference that contains a text string "Total Net Pay:", then I know the value I want will be in the next column on that row.
Has anyone got the code I would need that would give me the cell reference.
Thanks in advance,
Stu.
'Start of my code
Dim appExcel As Excel.Application
Dim xlWB As Excel.Workbook
Dim curNetPay As Currency
Set appExcel = New Excel.Application
Set xlWB = appExcel.Workbooks.Open("W:\my.csv")
With xlWB
.Worksheets(1).Select
curNetPay = .ActiveSheet.Range("E24").Value
End With
xlWB.Close
appExcel.Quit
Set xlWB = Nothing
Set appExcel = Nothing