Pass worksheets Name to API one by one

rishicool786

New Member
Joined
May 12, 2017
Messages
2
Hi Guys,

I want to run a piece of code for all the worksheets in the workbook. this code is an API which calls functions.
Code I am using is below.

Dim rngData As Range
Dim EPMObject As New FPMXLClient.EPMAddInAutomation
Dim WS As Worksheet
Dim Name As String

For Each WS In ActiveWorkbook.Worksheets
Name = WS
' In variable Name capturing Worksheet name and pass it to API
Set rngData = Range(EPMObject.GetDataTopLeftCell(Name, "000") & ":" & EPMObject.GetDataBottomRightCell(Name, "000"))

Next WS

but i am getting error as Name is not recognizable with API.

Please help me in finding what exactly can be passed in place of Name.

In place of Name
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
It would have to be Name=WS.Name because you want to pass the worksheet's name, not the actual worksheet.
Or just pass WS.Name
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,310
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top