I need to some help.
I found a page from a book and I wonder how to create this solution from the beginning to the end?
Here's your help:
Read the first several chapters of your book on how Excel works.
Start the Excel Macro Recorder
Execute the items in Step 6 of your book
Stop the Excel Macro Recorder
Look at the code Excel generated for you
Related
Sorry to bother you, i would like to stop people from being able to write code on VBA on my excel sheet.
But I can't do it since there is no VBA code already in place.
Then you will tell me to put some useless VBA code and protect it, but i can't do it because of workplace regulations (The document is approved as an excel sheet without vba).
So what do you think are my options ?
Is there a way to stop users from writing VBA code if you have no VBA code already written ?
If i use the project properties to add a password it won't work (because no vba code is written). I have tried this several times already
Thanks a lot,
Have a great day
How can i put some design in excel spreadsheets? like the photo below
I am using VB6 here. Thank you in advance.
You may try this,
Use Record Macro in Excel to record the steps you formatting in Excel. Then open the Macro you recorded in VBA. From there you should find the clues on how to do this in VB6.
I am using a simple macro found in internet for Multiple Goal Sheek in Excel 2010. The link is here
The point is that the macro is working in the example test MultipleGoalSeek(KB19).xls.
given in that link.
But when I try to apply it in my excel sheet, it only solves the first Goal Sheek problem, leaving the others un-calculated. I have no idea why although the macro seems pretty easy (maybe because they are not integers?)
I attach my excel problem with the macro.
Thank you
Hmmm .... this is a very early piece of brettdj code, it dates back to my beginner days a decade or so ago. And it shows .... !
The issue is in the third last row of the code, contrary to the instructons in the file, it was designed to work over columns only (I was running a time-based inventory adjustment at the time)
Change
For i = 1 To TargetVal.Columns.Count
to
For i = 1 To TargetVal.Cells.Count
And it works fine on your sample
I will work on the orginal code to run with variant arrays.
I have a report that I run from a system once a week, and the data is exported into an excel document. I have set up the tool that exports the data to excel to do a decent job on formatting, but there is still more that I need to do once the data is in excel.
Is it possible to create a stand alone macro, save it in a Microsoft office folder and be able to call it after I open this file? I have written plenty of macros that are part of ONE given spreadsheet, but never tried one that was open to many spreadsheets.
IS it possible, and a starting direction of good resources of where I can learn how to achieve this goal? Thank you.
...and be able to call it after I open this file?...
You have 2 very good options
1) Write and save your macro to Personal file. See this link for more information
Topic: Deploy your Excel macros from a central file
Link: http://office.microsoft.com/en-us/excel-help/deploy-your-excel-macros-from-a-central-file-HA001087296.aspx
Quote from the above link:
Have you ever wanted to use that really handy macro in all of your Excel worksheets? You can. This column explains how to place your macros in a file called personal.xls and make them available each time you start Excel.
2) Create an Add-In
Topic: Creating an Excel Add-in
Link: http://msdn.microsoft.com/en-us/library/aa140936%28v=office.10%29.aspx
Quote from the above link:
You create a Microsoft® Excel add-in by creating a workbook, adding code and custom toolbars and menu items to it, and saving it as an Excel add-in file.
If an Excel Workbook has many sheets and some of them have macros inside, the only way I have found to determine which sheets have macro is by clicking each of them in Project Explorer (Ctrl+R in VBA).
Is there any other way to do this?
I answered a question recently in MSDN and ultimately wrote a blog post on it.
Topic: Check if an Excel File has a Macro
Link: http://www.siddharthrout.com/2012/04/12/check-if-an-excel-file-has-a-macro/
You can then use .VBComponents.Item(i).Name with .VBComponents.Item(i).Type to check which "Sheets" have "macros".
EDIT
Technically speaking every macro is a piece of code but it's not necessary that every piece of code is a macro. So if you are just checking for macros then see the 1st part of the blog post and if you are checking for any code then look at the 2nd part of the blog post.
You can loop over the sheets and use the following syntax:
If ActiveWorkbook.VBProject.VBComponents(sheetName).CodeModule.CountOfLines <> 0 Then
sheetName being the name of the sheet.
For more advanced use, you should check this page which gives more advanced examples.