RunCode Macro

Moxioron

Active Member
Joined
Mar 17, 2008
Messages
436
Office Version
  1. 2019
Hello all.

I am trying to run a module via a Macro and I am having issues with the Function Name. I have never used a Macro to run code so please excuse my ignorance on the subject.

The Function Name I am using is:

Sub ImportKFile()

That is not the name of my module, but I am getting 'Microsoft can't find the name 'Public' you eneted in the expression'

Any assistance would be greatly appreciated. Thank you.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You are correct that you need to create a function is you wan to call it from a Macro.

Unfortunately you have create a Sub not a Function.

It should look something like this:

Code:
Public Function ImportKFile()

End Function
 
Upvote 0
Bob, Thanks for jumping in!

bigsmile.jpg


Feel free to do the same, any time.
 
Upvote 0
Thanks , I was stuck doing similar calling sub chagne to function now its working..
kind regards
Farhan
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

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