SBendBuckeye
Programmer
Hello all,
I have done a good bit of Access programming but not a lot of Access automation where I control Excel. I have been given a huge spreadsheet and asked to put together a plan to convert it. I know it has hundreds, maybe more formula in it. I am trying to spin through all of the sheets within the workbook and count and/or display the formula for each sheet in turn.
Below is the code I am using, part of which I found on this forum a while ago.
Dim objExcel As Object
Dim sh As Excel.Worksheet
Dim oCell As Object
Dim intCounter As Integer
open workbook, set reference to Excel file, etc is working
For Each sh In objExcel.sheets
intCounter = 0
sh.Cells.SpecialCells(xlCellTypeFormulas, 23).Select
For Each oCell In Selection
intCounter = intCounter + 1
MsgBox oCell.Address & " " & oCell.Formula
Next oCell
Debug.Print objExcel.Name, sh.Name, intCounter
Next sh
Can someone please tell me what I am doing wrong? Thanks in advance for any help you can give me!
Have a great day!
I have done a good bit of Access programming but not a lot of Access automation where I control Excel. I have been given a huge spreadsheet and asked to put together a plan to convert it. I know it has hundreds, maybe more formula in it. I am trying to spin through all of the sheets within the workbook and count and/or display the formula for each sheet in turn.
Below is the code I am using, part of which I found on this forum a while ago.
Dim objExcel As Object
Dim sh As Excel.Worksheet
Dim oCell As Object
Dim intCounter As Integer
open workbook, set reference to Excel file, etc is working
For Each sh In objExcel.sheets
intCounter = 0
sh.Cells.SpecialCells(xlCellTypeFormulas, 23).Select
For Each oCell In Selection
intCounter = intCounter + 1
MsgBox oCell.Address & " " & oCell.Formula
Next oCell
Debug.Print objExcel.Name, sh.Name, intCounter
Next sh
Can someone please tell me what I am doing wrong? Thanks in advance for any help you can give me!
Have a great day!