Gos-C
Active Member
- Joined
- Apr 11, 2005
- Messages
- 258
- Office Version
- 365
- 2016
- Platform
- Windows
Hi all,
I have the following code in a common workbook, TestMacro, (i.e., one used by several users) which I need to use in different workbooks:
The above ranges are in worksheet 01Apr2011, which is in a workbook (named April2011) - and is opened.
However, when I run the macro, it is reading and writing to Sheet1 of the TestMacro workbook instead of 01Apr2011 of the April2011 workbook.
Can any help me with getting the 01Apr2011 sheet to be the active sheet, please.
Thank you,
Gos-C
I have the following code in a common workbook, TestMacro, (i.e., one used by several users) which I need to use in different workbooks:
Code:
Sub TotalPaidClaims()
Dim cRange As Range, pClaims As Long
Set cRange = Range("EE2:EE" & Cells(Rows.Count, 1).End(xlUp).Row)
pClaims = Application.WorksheetFunction.CountIf(cRange, "Paid")
Range("EH2") = pClaims
Range("EH1") = "Paid Claims"
Range("EG1") = "Select Type"
Range("EK1") = "Risk Based Selected"
Range("EJ1") = "Risk Based Minimum"
Range("EI1") = "SVS"
Range("EL1") = "Random Selected"
End Sub
The above ranges are in worksheet 01Apr2011, which is in a workbook (named April2011) - and is opened.
However, when I run the macro, it is reading and writing to Sheet1 of the TestMacro workbook instead of 01Apr2011 of the April2011 workbook.
Can any help me with getting the 01Apr2011 sheet to be the active sheet, please.
Thank you,
Gos-C