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.

1
vote
1answer
25 views

How to increase speed of code using data structures rather than for-next loops?

I have already resolved several others using Application.Index with Application.WorksheetFunction.Match and reduced time to perform from about 7-8 seconds to milliseconds. But I feel there is still ...
0
votes
1answer
92 views
+250

Generate all possible permutations given input values

UPDATE 2 cybernetic.nomad is correct, I am after all permutations. I will update the original question and title to reflect this. UPDATE 1 - SUGGESTED DUPLICATE DOES NOT ANSWER QUESTION: My ...
0
votes
0answers
9 views

How to convert range of image file path from local folder as comment in the selected destination range?

I'm asking for your help. My research ended up in 2 different macros that combined will give a good utility for my work. This VBA code will insert image as comment. This VBA code will fetch ...
-2
votes
0answers
23 views

Need help to write VBA

I am new to VBA and don't know how to wright it. I have spreadsheet that needs to be converted to the different format. I used the "IF' formula it gave me the result but it didn't completely did what ...
0
votes
1answer
23 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
votes
0answers
20 views

How can I make Excel visually update cells?

I am using Excel 2016. I have a small spreadsheet that is exhibiting some unusual display problems. When I recalculate a range, which includes all cells on the sheet with content or formulas, two ...
-1
votes
0answers
28 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
8 views

VBA 'insert file' not including contents of content controls from source document

I have a VBA form for word 2016. In this 'Main Document' I can select other word documents to insert at the cursor point into my document. The docs include mapped content controls, and I find that ...
0
votes
1answer
30 views

Combine multiple row into one, keeping columns data

I have the following type of table Current table P.no. P.Line ian feb mar apr mai iun iul aug sept oct nov dec 100001 Line1 100 ...
0
votes
1answer
3k views

Excel VBA - Getting “Object Required” Error When Stating Range Is Not Null

Below is my code where I'm getting the error. I've marked the line that the error occurs on in bold (i.e. ** at the beginning and end of the line **). The specific part of the code I'm receiving ...
0
votes
1answer
3k views

How do I implement the VBA module to copy filtered data

I need to implement a VBA Macro that copies data from one excel worksheet and puts certain column into another one. Sub sbCopyRangeToAnotherSheet() 'Method 1 Sheets("Sheet1").Range("A1:B10").Copy ...
1
vote
2answers
257 views

Word's Find/Replace Modal in VBA

I want to prepare and show the Find/Replace dialog. However, the following code shows the dialog in a modal status, and you can't get to the document text. Any ideas how make it modeless, just like ...
2
votes
0answers
17 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
23 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
1answer
3k views

Set printer Excel vba macro

Im trying to print through a macro to a shared printer on a colleagues PC. I have tried the following but to no avail Sub Tag() ActiveCell.Resize(1, 1).Copy Worksheets("Sheet1").Range("A1") ...
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 ...
1
vote
2answers
3k views

Outlook VBA macro to forward email attachment, but delete message body

I am trying to add a custom action to a rule in Outlook where a message is automatically forwarded and the attachment stays but the original body message is deleted. I need to write code for the '...
0
votes
0answers
27 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
17 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 ...
1
vote
3answers
1k views

Force two separate tables to have same amount of rows

I have two separate tables in Excel that I would like to both have the same first column and the same amount of rows. I filled in the first column of the second table by referencing the first column ...
2
votes
2answers
4k views

Insert specified number of columns between two named columns

I am trying to use VBA to insert a set number of columns between two preexisting and defined ones. However, it keeps inserting the new columns to the left of the range. I want to insert the columns ...
0
votes
2answers
3k views

How to repeat "copy range (A1:A5) to Range B with transform (column to row)?

I have a data in the Range A 1 a1 2 a2 3 a3 4 a4 5 a5 6 b1 7 b2 8 b3 9 b4 10 b5 and I copied A1 to A5 to Range B10, B1 to B5 to Range B11, C1 to C5 to Range B12 and so on with transform (from column ...
0
votes
1answer
3k views

click on a cell change the value of another cell

I can not achieve to do what looks like an easy process... I would like to give a value ("Hello") to a cell (named "ClInfo") in sheet named "Hardware" by a click on a cell (C47) in sheet named "1". I ...
0
votes
1answer
4k views

There isn't enough memory to complete this action

I have a little issue with excel. Everytime I open up a sheet I get this error: after like 10-15 minutes. I have tried several things listed on the internet, here is a list on the things that I tried:...
0
votes
1answer
4k views

I want to hide rows in Excel 2010 using VBA if a cell value is blank

I can get the VBA to work just fine to do this, but my spreadsheet is 20MB without data. What I want to do is find the first time a cell is blank and then hide every row at once from that spot until ...
0
votes
0answers
20 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
3answers
4k views

Compare two sheets in Excel and extract the differences to other third sheet

My situation: I got a huge excel sheet from a manufacturer of products for my online shop. This format: product ID | price | name | ... Every week the manufacturer is sending me a updated list ...
0
votes
0answers
34 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 ...
0
votes
2answers
112 views

Outlook BCC prompt VBA doesn't automatically run

I'm still pretty new to VBA (so sorry if this is a dumb question) though I am already coding small applications a few years for like buttons in excel or something. But this one has never ben clear to ...
-2
votes
0answers
38 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 ...
0
votes
3answers
5k views

Excel VBA - code to skip lines / goto command

I have built a code into excel to take the data from a pivot table and insert it into a chart, a pivot chart directly linked to the table wont give me the manueverability I am looking for. The reason ...
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 ...
0
votes
1answer
9k views

Excel 2010: dynamic update of drop down list based upon datasource validation worksheet changes

I have one worksheet for setting up the data sources of multiple data validation lists. in other words, I'm using this worksheet to provide drop down lists to multiple other worksheets. I need to ...
1
vote
1answer
28 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 ...
6
votes
2answers
7k views

Delete ALL custom cell styles EXCEL

Is it possible to delete all the custom cell styles in a workbook ? Without having to delete them all one by time.
0
votes
1answer
4k views

Updating another Excel spreadsheet from current spreadsheet

I used the VBA code in "How do you write an Excel formula that will paste a specific value in a different cell?" posted here in May 2013 and it works well to populate/fill another cell in the same ...
1
vote
2answers
4k views

Find Related Messages in Outlook 2010 with New/Popup Window like in 2007

In Outlook 2007, to help clear the inbox, finding related messages would open a new small window that would allow to open the messages or to move them into folders easily, then go back and do the same ...
2
votes
1answer
7k views

VBA: How to replace entire Excel cell value basing on its content?

I have an Excel Spreadsheet with some names in a cells. There can be as one name per cell as multiple names in one cell. For example: Cell A5 contains "Joe", cell BD54 contains "Joe;Harry;Molly", ...
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 ...
7
votes
8answers
144k views

Excel VBA “Unselect” wanted

I would like the final appearance after my VBA has finished running to be empty of selection -- to have no cell or range on any sheet colored (if it was range selected) or in a bold line box (anything ...
0
votes
1answer
5k views

How can I divide cells into two parts in Excel?

For example I want to divide cell B2 into two parts, without inserting any new row or column. Please see the screenshot below:
2
votes
2answers
5k views

Format Change Event for Excel VBA

I'm trying to prevent people from modifying (most) of my spreadsheet while still alowing them to use the sort function of the AutoFilter. What I've done so far is used the Worksheet_Change event and ...
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 ...
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 ...
-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
6k views

How to customize Paste Value Excel Short Cut

I was reading in this other post how to set up VBA code to paste values in Excel. I understand how to create the VBA code. I would like to set the keyboard shortcut to Ctrl d but Excel pops up an ...
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
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 ...