All Questions
1,120
questions
4
votes
1
answer
3k
views
Execute SolidWorks in background and exit with VBA macro
I am trying to do a complex geometry using SolidWorks and a VBA macro that I launch it with a batch script.
Firstly I did a simple macro to check if it is possible to run solidworks in background, ...
4
votes
3
answers
507
views
Some extrusions in loop in solidworks VBA don't work
I am attempting to run a loop of extrusions in solidworks API using VBA. The height of each extrusion is determined by the brightness of the pixels in a bitmap.
For the most part the code works as ...
4
votes
3
answers
7k
views
VBA macro in Excel 2016 for Mac: SaveAs will not work with a CSV file format
I am running a VBA macro in Excel 2016 for Mac. The macro works on Windows platforms with Excel 2016, and on Mac platforms with earlier than the 2016 version. The issue appears specific to Excel 2016 ...
4
votes
2
answers
492
views
Excel VBA - Renaming named ranges causes unreadable content error?
I'm trying to teach myself VBA by completing a project, but unfortunately I've reached the limit of what I can figure out.
The project involves a workbook with worksheet intended to be used as a ...
3
votes
3
answers
14k
views
What are the Pros and Cons of VBA Code vs Macros in MS Access?
I have been working on a database and wanted to do it using purely VBA codes. However, I was told by a friend that its more secure for me to use macros because the database will be used on a local ...
3
votes
3
answers
64k
views
Copy and Paste row by index number in Excel Macro
I'm trying to copy an entire row by index number and paste it to another row with a different index number when a certain condition is met (I know the issue is not with the conditional logic). I'm ...
3
votes
2
answers
2k
views
Prompting a macro on close of workbook, but kill the closing if user press "No"
I am trying to execute a macro on close of a workbook.
The macro works perfectly but the problem is the closing function. I want a user to be prompted to say "Yes" or "No" when closing the workbook. ...
3
votes
1
answer
2k
views
How to call a Sub from another Sub dynamically
I have never come across this idea until now, but is it possible to set another macro to a variable within my current macro to call it from the VBA code? I have made the attempt to do so in my limited ...
3
votes
1
answer
4k
views
Run macro when linked cell changes value (Excel VBA)
I am currently trying to obtain historical information about how the backlog is developing.
My Excel file is based on queries from an Access Database which can give me a view of the current ...
3
votes
1
answer
2k
views
Dynamically add and run a vba code
The followings are my current steps
Access file exports a CSV file by Macro (VBA code)
The exported CSV file get modified by Macro (VBA code)
Right now, I'm executing the macro on Access (step 1)-> ...
3
votes
3
answers
2k
views
vba excel AdvancedFilter method for a table with dates criteria does not work
first af all i'm glad to enjoy this nice community, this is my first post so apologize me in advance for any mistake i'll do in the post.
I got a table named example generated by importing data ...
2
votes
2
answers
700
views
VBA to past certain cell values on different worksheet in predetermined columns
Gods of VBA,
I would like to request your help on some code i can't seem to get working straight.
Purpose,
When a row has a cell Value "x" on row A in sheet 'Dump', i would like to past certain ...
2
votes
1
answer
3k
views
How to identify Excel 4.0 Macro?
We were trying to Sign an Excel Macro, but got an error that it contains Excel 4.0 Macros and hence it can't proceed to sign them. MSDN says it won't allow Excel 4.0 Macro's but we couldn't find ways ...
2
votes
2
answers
18k
views
How to open Excel workbook without updating external data sources (but keeping it enabled)?
I have some workbooks, which starts with automatic macros and data refreshing (and, pre-empting some suggestions, these workbooks need to work like that, because I'm starting them automatically from ...
2
votes
2
answers
94
views
If 0 or "" delete row: code works but very slow
Question:
With the recorder and help on this forum I made a code (for a button). Column 'i' has got (from row 25) 'Pcs' or a number. My Macro finds Pcs and changes it to "" and than the macro deletes ...
2
votes
5
answers
2k
views
VBA Macro is running extremely slowly
I have this Macro, and finally got it figured out, but it is running very slowly, and would take about 3 days to get through my one sheet of 800 000 lines, and I have 100 sheets. I would appreciate ...
2
votes
2
answers
98
views
VBA: Fill cells based on 'random' content from column
i'll try to explain my problem.
I need to fill values based on one of four values that apears in cells (column).
I have a code
Sub testmacro()
If Sheets("List1").Range("A1") = "Keyword1" Then
...
2
votes
4
answers
5k
views
Make macro run in specific workbook
This seems like such a simple request, but I can't seem to find any answers online.
I have two open workbooks (lets say A and B). All I want to do is run a macro that I have created in Workbook B and ...
2
votes
2
answers
209
views
Save file xls in dynamic directory
I am trying to create a macro that saves the xls file in a specific directory called Months in this directory there are 12 other directories with the name of the months.
I wrote a Macro where the file ...
2
votes
2
answers
768
views
Copy cells "n" number of times. "n" is user specified
I am trying to code a macro that will look at the numerical user input in one sheet and will copy something that number of times in another sheet.
For example, I want to copy the company name and ID "...
2
votes
2
answers
3k
views
How to draw a dashed line between two cells if a condition is met in Excel
My Excel file looks like this :
How would I go about drawing a dashed red line between cell (xxxx) and cell (aaa) if a certain condition is met?
2
votes
1
answer
2k
views
Loop through each WS in each open WB and unprotect
I need to complete a task which involves collating data from a large amount of workbooks, I have put them all in the same folder and are all *xlsm files.
I already have a macro to grab the data from ...
2
votes
2
answers
24k
views
VBA to paste value in next empty cell
I have a VBA macro that simply copies the value from one cell (Worksheet1.a1) into another cell (Worksheet2.a1), that is triggered by a button with the assigned macro.
Sub copy_values()
...
2
votes
2
answers
154
views
Delete rows based on more than one condition
can you help me with the following code I made?
Sub DeleteRows()
Dim c As Range
Dim SrchRng
Set SrchRng = ActiveSheet.Range("A1", ActiveSheet.Range("A65536").End(xlUp))
Do
Set c = SrchRng.Find("...
2
votes
2
answers
741
views
Add Module code of BeforeDoubleClick_event to dynamically created worksheets
I have this code:
For a = 1 To 5
strFoglio = "SheetName" & a
Sheets.Add
ActiveSheet.Name = strFoglio
ActiveSheet.Move after:=Sheets(Sheets.Count)
Next a
Is there a way to write ...
2
votes
1
answer
2k
views
VBA Copy and Paste Between Template Worksheet and Variable Worksheet
I've edited this post to show that I have done some research on this. Some of the code below was captured during a "Record Macro" session. I just can't figure out how to change the workbook names that ...
2
votes
1
answer
3k
views
Find and Replace in Excel 2010 without losing cell formatting - unable to run on a cell that has 255 characters
I am using this macro in Excel 2010 to find and replace words without losing cell formatting (e.g. some words are in bold, some are in italics so this macro just makes sure the cell keeps the same ...
2
votes
1
answer
4k
views
run a macro on another workbook and then close the workbook that launched the macro
How to
1. Run macro from current (FIRST.XLSM) workbook to open another workbook(SECOND.XLSM)
2. Run Macro on (SECOND.XLSM) workbook that closes (FIRST.XLSM) and then continues its procedure
I tried ...
2
votes
1
answer
187
views
Vim: How to use .config to dim lines that are not compiled in
When reading the linux kernel source code in Vim, is there any way to tell the editor that there is a .config file at a certain location, and that it is to dim lines that are within macro guards that ...
2
votes
2
answers
3k
views
How to Find special Characters in a column with like in excel macros
I am facing problem while searching for special characters in a column in excel vba.
I used the like operator as follows:
If Sheets("Eclipse Report").Cells(j, k).Value Like "*[%, !, *, ;, :, ~, °, ß, ...
2
votes
2
answers
2k
views
Changing colour of cells using command button (VBA Excel)
I currently have a userform that loads up with three command buttons (primary, secondary and tertiary). The idea here is that a user will select their own colour scheme using these three buttons.
I ...
2
votes
1
answer
3k
views
Count rows and filter and then delete filtered rows with VBA
Can any one tell me how to count the total number of rows in an Excel spreadsheet and then pass the value dynamically?
Instead of the value of 2691 for the last row, I want to pass lastRow variable ...
2
votes
2
answers
266
views
some characters lose formatting in vba macro others don't
I have a number of documents that are made in the pre-Unicode era, and contain transcriptions of various languages, each with their own fonts.
I made a macro that replaces every character in a ...
2
votes
3
answers
61
views
How to create a parameterized add-in for an excel workbook
I need to create an excel add-in that takes parameters of the upper and lower bound of two data sets. I currently have a function written that performs the correct calculation for integration using ...
2
votes
1
answer
2k
views
How to bypass "Select Data Source" Prompt For Query Tables w/ VBA
I have a macro that exports queried data from SQL into a Query Table in Excel. The whole process is done through a macro and it's been set-up an ODBC connection. Since the connections are already set-...
2
votes
2
answers
1k
views
Why does my VBA macro stop after opening and closing a few hundred CSV files?
I've written a macro that downloads zip files containing CSVs from a website. The downloading and unzipping is going perfectly, however when I try to loop through the CSVs searching for the occurrence ...
2
votes
1
answer
1k
views
Getting the order of the selected ListBox items in VBA?
I have two list boxes, one on the left and once on the right. Ideally, I want the user to be able to select whatever data he wants from the left list box, and press the "Add" button for the items he ...
2
votes
1
answer
2k
views
Optimizing VBA / Excel Macro Code (Finding Duplicates in Large Sheet)
I haven't really ever coded in VBA or anything of the sort except short little things in VB done years ago. This is my attempt at writing some code that will search through a excel sheet database of ...
2
votes
1
answer
11k
views
Error 450: Wrong number of arguments or invalid property assignment on vba
Im writing an excel sheet for work that when I press a button a loop runs through some rows and will edit some data if they're empty but I cant seem to get the macro to run as it keeps returning the ...
2
votes
1
answer
597
views
I Need a Excel VBA code for to copy paste a range of cell
To be short and sweet with my requirement, I need a code to do the conditions below.
Select from range A2:G5
Then check if a sheet named with current date i:e 29-02-2016
If yes,
then copy paste ...
2
votes
1
answer
2k
views
Adding file date created to list
I've been trying to edit a bit of code which gives a list of all files in all subfolders to also give me the date created in the next column but am unsure how. Here is the code i'm working with: It ...
2
votes
1
answer
1k
views
How to handle missing xml node in excel macro
I am using ms excel for macro written in vb. I am reading xml file, looping through and few nodes as missing. see the xml example below :
<document>
<element>
<fname></...
2
votes
1
answer
21k
views
VBA Run Time Error 1004 AutoFilter method of Range class Failed
I hope you can help. I am getting the error Run Time Error 1004 AutoFilter method of Range class Failed
When I run my code Public Sub TestThis(), the funny thing is It works perfectly by itself, but ...
2
votes
3
answers
381
views
First Available Cell in Column within Excel Macro
I am creating a macro to take an entry and put it on the first available line. this is what I have so far. It doesn't work, but what I am trying to do is to use the Range function to select the ...
2
votes
1
answer
2k
views
Possible bug? xlwings cannot run an Excel macro? [duplicate]
I am having a problem getting xlwings to run a macro from Python. Despite following the code from xlwings documentation, I cannot get xlwings to execute an Excel macro. For instance, in Excel workbook ...
2
votes
2
answers
1k
views
Excel VBA: How to Loop Through Workbooks in Same Folder using Given Code?
(Previous Post)
I need to create a macro that loops through the files that are in a single folder and runs the code that I have provided below. All the files are structured the same way however, ...
2
votes
1
answer
218
views
Share macros modules between excel and word
Over the last two years I have written several macros for excel and word and saving them in normal.dotm and personal.xlsm. I have some modules that handles filereading,database interactions, html ...
2
votes
1
answer
8k
views
Excel Macro to copy row of data to bottom row
Good day,
I am trying to create a macro that copies data from the current month row to the bottom. The current month row is refreshed and the date will change for a new month (sep--16), but before it ...
2
votes
2
answers
3k
views
VBA to find text from webpages
I have created Macro which gives me all URLs present on any webpages.
We just need to provide the URL and it gives us the all links present in that webpage and paste it in one column
Private Sub ...
2
votes
1
answer
4k
views
Macro to insert comments on keywords in selected text in a Word doc?
I'm new to VBA and would greatly appreciate some help on a problem.
I have long Word documents where I need to apply standard comments to the same set of keywords, but only in selected sections of ...