Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [vba]

Visual Basic for Applications; a subset of Visual Basic used in all Microsoft Office applications. Consider using this tag together with the tag for the specific application in question. Good questions on VBA generally contain some code and asks for solution of specific issues. Questions asking for entire solutions (please give me the code / how to do this and this with VBA) are off topic and will be closed as too broad.

2
votes
0answers
11 views

Outlook run VBA script on email to move to folder based on 6-digit number in subject

Our company uses a 6-digit number for our projects. I'm attempting to create a script that will search the email subject for this 6-digit number, then find the subfolder that starts with this 6-digit ...
-1
votes
0answers
18 views

VBA check existing file timestamp on network

I don't know how or where to start & Excel VBA MsgBox doesn't help me at all. My employer has a shared excel file that multiple people access & use on a network & saving has become an ...
0
votes
0answers
21 views

Hiding row if there is data in all cells of a row

I've searched high and low but couldn't find an answer to fit my issue. I was wondering if someone could help me figure out a code for.. If all cells in a row contain data then hide the row; if there ...
1
vote
0answers
9 views

Want rows to hide/unhide automatically as cell changes without having to run the vba everytime

I don't want to have to press "Alt F8" to hide 0 value rows and unhind rows >0 I want it to Do it Automatically as the data changes. This is the VBA code that works to hide/unhide rows with a value ...
0
votes
0answers
21 views

Closing COMAddin login window when excel is opened from batch file

I am opening an Excel (.xlsm) workbook using a .bat file. @echo off pushd \\Network123\Folder123\ "Retrieve.xlsm" Note: I need to open the file using command line as the macros I need to use are in ...
0
votes
0answers
22 views

Why doesn't this MacScript return a valuable on Excel

I have the following VBA Script Dim fileName As String fileName = MacScript("choose file name") MsgBox fileName ✅ If I run the AppleScript in Script Editor, and select a pre-existing file, a path is ...
1
vote
0answers
16 views

BeforeDoubleClick on Protected Cell

I wrote some code that manipulates the target cell when it is double-clicked by the user. The code works fine for most cells on the worksheet. But the worksheet is protected (only unlocked cells ...
0
votes
0answers
51 views

Generate all possible combinations given input values

UPDATE - SUGGESTED DUPLICATE DOES NOT ANSWER QUESTION: My question is different from the suggested duplicate. The suggested duplicate does not show all possible variations based on the number of ...
0
votes
0answers
19 views

Is it possible to run a vba macro inside a vbs script?

Long story short, I'm a complete newbie when it comes to VBS (our dev left half work done and then dissapeared) so I """"made"""" (got help from SO) a macro that basically organize HR data based on ...
0
votes
0answers
33 views

Moving selected cell data in excel right or left without using cut + paste or, copy and paste. Move data with arrow keys would be great

Hi I would like to know how to run a VBA or macro (or any other simpler way) to shift the values only of any current selection (varying from one cell in one row to multiple cells and selections across ...
-2
votes
0answers
36 views

Excel not working post 1809 W10 update

HNY. Since updating last week to Feature Windows 10 (1809), my Excel (2016 or 2007, tried both) seems to have issues. VBA code that was running fine no longer works (run-time error '1004') and even ...
-1
votes
0answers
26 views

Selecting strings in a Word document other than URLs and changing font color to red using VBA

I have a word document that has a lot of URLs followed by their descriptions mostly separated by a dash (-) but not always. I would like to write a script in VBA that selects those descriptions (minus ...
0
votes
0answers
6 views

Using VBA how would I put selected text of a third party application into the clipboard? [migrated]

I have the following issue. I need to put a selection of text of a third party (thus not Word / Excel...) application (see an example below of the selection), into the clipboard: Doing this I may not ...
1
vote
1answer
27 views

GetClipboardData always returns NULL

I have the following code: Public Declare Function GetClipboardData Lib "user32" (ByVal wFormat As Long) As Long Public Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long Public ...
0
votes
0answers
12 views

dylib built vs run time path (LC_LOAD_DYLIB?)

From What is the significance of a macOS Mach-O dylib LC_ID_DYLIB name, or install_name? I understand that LC_ID_DYLIB sets the path at which to find the dylib at runtime, which is not the same as the ...
0
votes
0answers
19 views

VBA 7.1 for macOS can only access /usr/lib when calling a function in a .dylib file?

Visual Basic for Applcations 7.1 for macOS reports Run-time error '53': File not found: libMyFile.dylib whenever I call a function in a dynamic library not in /usr/lib.
1
vote
1answer
30 views

Excel VBA Macro - Copying data from multiple sheets in existing file, and creating new file and pasting selected data into separate sheets

any and all help is greatly appreciated. Description: I have an excel file with several sheets of data. I need to copy ALL of the data from multiple sheets, create a NEW excel file, and paste that ...
-1
votes
0answers
18 views

Excel Cell Mandate on the basis of another cell

I would like to mandate a comment in column D, if user selects a value of 1 (out of a drop down list of 1,2,3) in column C. For example, if the user selects 1 in column C5, then the user must not be ...
0
votes
1answer
10 views

Find and copy tables with 1 row

I have a Word document with multiple tables and I want to copy and put into a new document only those tables with 1 row. I have VBA code to copy all tables from the source doc to the new doc, but want ...
0
votes
0answers
16 views

command button execute copy and paste of worksheets into a new workbook and then automatically runs a macro in the new worksheets

I am working from an existing workbook in a worksheet(xlsb). I am looking to use a activeX control command button to copy and paste (values only and protect cell values or a value lock) two sheets of ...
0
votes
1answer
22 views

Compare two columns and paste it in third column code not working

I have two columns with below data: DATA_TYPE DATA_TYPE Result VARCHAR2 VARCHAR2 1 NUMBER NUMBER 1 VARCHAR2 NUMBER 1 I am using below code to do the comparison ...
0
votes
0answers
40 views

Display a countdown timer for web query refresh

I have a web query set up to refresh data when the workbook is opened and then refresh data every 15 minutes, but I would like to display the last refresh time and the remaining time left until the ...
0
votes
1answer
40 views

Deleting Duplicate Transactions - VBA or Function

Example Transaction Set: Note the 3 transactions shown. The two transactions highlighted in green are the ones I'd like to delete or flag (doesn't matter). Using VBA, the code is way too clunky. The ...
0
votes
0answers
29 views

Automate clicking download CSV button on webpage and saving then importing as worksheet in current workbook

I'm trying to automate a manual process which is as follows: 1. Open webpage (https://trans-logistics.amazon.com/fmc/execution/JA3Nk--CPTs_(24_Hour_Pool)) (don't bother clicking - link only works ...
0
votes
2answers
67 views

Delete rows on different worksheets (No loop)

I'm a beginner is coding, and im trying to figure something out. I want to delete rows on different worksheets defined in an inputbox. My code is only working on sheet 1. And not on Sheet 2. Can ...
0
votes
1answer
32 views

Compare multiple columns in two sheets to get a value

I have limited working knowledge of Excel VBA macros. I have two sheets called "Summary" and "Data" The Summary sheet has fixed rows and columns. The Data sheet has values in it. I need to compare ...
0
votes
1answer
40 views

Outlook / VBA How can I count the mail I moved by outlook rules?

I have created outlook rules for a shared mailbox. Now, I would like to understand how many of the e-mails are processed through the rules. One of the rules is that an email is moved based on the ...
2
votes
0answers
47 views

How to fix error in VBA code

I am trying to email the sheet within workbook, sometimes the code works but sometimes returns an errors. This line kicks error is,: If Dir(FileCell.Value) <> "" Then Error says: Run-time ...
0
votes
0answers
19 views

Mac Excel - VBA written in Japanese gets corrupted

I have an excel file with a password-protected VBA macro written with Japanese characters that I'm having quite the trouble of working with. Whenever I tried opening it on Excel 2016 for Mac OS X, ...
0
votes
1answer
38 views

Very simple VBA error

I keep getting a syntax error in the following VBA function: Function F_1(k_, x_) F_1 = (x_^3 - 3.0 * k_ * x_^2 + 3.0 * k_^2 * x_ - (5.0/7.0) * k_^3) / SQR(x_ - k_) End Function Anybody know ...
1
vote
1answer
54 views

VBA code executing very slowly

I'm new to VBA so the code I've written is very sloppy. My apologies. The essence of my problem is that I need to delete duplicate rows from a worksheet with approx. 45,000 rows. Each iteration ...
0
votes
1answer
18 views

Disable a macro, with another macro. EXCEL VBA

I have 7 macros that prevent a user from copying and pasting in a workbook. However, now and then I want to be able to copy and paste. Is there a way to disable these macros with another macro ? I ...
0
votes
0answers
24 views

VBA POWERSHELL EXEC Runtime error : system can not find the specified file

i am trying to run a few powershellscript from vba excel , it was working fine . But now am getting error of system can not find the file . Sub Button1_Click() strCommand = "Powershell -File ""C:\...
0
votes
1answer
14 views

Unexpected Results in Referencing another worksheet indirectly

I'm not getting the expected reference result in the following Scenario Can someone please explain this. Create a workbook with 2 x WorkSheets , Sheet1 & Sheet2 Populate Sheet2 Col A1 Down ...
2
votes
1answer
105 views

Copying a range using Combo Box criteria

I'm trying to copy a range that meets two criteria from two combo boxes on a user form. ComboBox1 contains criteria 1, the Branch. ComboBox2 contains criteria 2, the Quarter. Column A needs to match ...
0
votes
0answers
24 views

VBA - Excel Stops Responding - Table Applied to Whole Sheet?

I have a button that calls many separate macros. Everything works as expected, but with 1 exception. I need to input a formula in row 2 of four separate columns and have the formulas drag down to the ...
0
votes
1answer
28 views

Add todays date when opening saved email template

I want to add a message and the date when ever I open an email template I have saved. I could only manage to get to the below bit of code: Private Sub adddate() .Item.Subject = "Prep Status ...
1
vote
1answer
39 views

Is the 64kb size limit to modules corrupting macros for excel 365?

I'm having random macro corruptions where I can't open the workbook. I would have to disable all macro without notifications then open the workbook and recompile the macros, save close. Then enabled ...
2
votes
1answer
29 views

Delete all rows not containing xxxx

I found and modified the below code to remove all rows that don't contain "NHO_Global" in column F, but it deletes everything (it does leave the header row, though). What did I do wrong and how can I ...
0
votes
0answers
22 views

See who last changed category color on outlook email

Here is the situation. Someone at work in a shared inbox keeps changing the category on incoming email to a specific color. For this shared inbox those colors represent the employee who has picked up ...
0
votes
1answer
26 views

Extract Unique Substring from Range of Excel

I have cell values with names that are fairly close to each other. I would like to extract a common sub-string. Here is an example. 1100_250_Jump_12HR_100MD_S_run1 1100_250_Jump_12HR_100MD_S_run2 ...
0
votes
1answer
32 views

Removing rows in an excel worksheet if duplicate is found in another worksheet

I have two worksheets: "compiled" and "firstpickup". What I'm looking to do is delete rows in the sheet "firstpickup" if the value in column A can also be found in column A of "compiled". "compiled" ...
0
votes
1answer
39 views

MS Excel VBA to Export to PDF Terminates Suddenly and forces computer to reboot

I have some VBA code (see below) that basically prints named ranges in an excel file to PDF. I have command buttons for each macro and It works fine, but when i'm printing them sequentially you (...
0
votes
1answer
63 views

Change a macro that only works if the range starts with an A1 or T1 etc. cell

I have a macro that works but I would like to change the cell range from Set SearchRange = Range("E1:E12") to Set SearchRange = Range("A21:A32") I have made the change in the code but it won’t ...
0
votes
0answers
24 views

Lock Cells Based on Conditionally Formatted Interior Color

I am working on a project that requires locked cells based on how the cells are conditionally formatted. In this instance the conditionally formatted cells have interior color 15. This is the rule ...
0
votes
1answer
19 views

Data extraction from hyperlinked workbooks

I have hundreds of different workbooks to work with and extract certain data from them and summarize these data in a separate workbook. This overview workbook contains hyperlinks to the single ...
0
votes
2answers
73 views

VBA Error: Out of stack space

I have a very simple macro in an Excel sheet, to allows users to recalculate. I have no other macros/code in the workbook, and only this work book open Sub Calculate() Calculate End Sub This is ...
0
votes
1answer
31 views

VBA - Create and save to folder according to date

I need to do a couple of things that seem to be easy, but I'm having a hard time figuring out how to implement. I need to create a folder using today's date. That part's fine. Then I need to save a ...
0
votes
1answer
57 views

Excel dynamic search vba code

With this VBA macro for Excel I get instant search filter when I type the whole word, but I want it as follows: when I type O for opel, that I get opel already showing. This is the code: Sub ...
-2
votes
1answer
49 views

How to Filter Data Based off Cell Value

I am trying to filter my data based off of a cell value. My data will be a large range for 12 months. So far I am able to filter only one month, I cannot figure out how to filter all 12 months based ...