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,529 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
1 answer
1k views

Delete or create Excel cell cell style group

In Excel, the built-in cell styles are grouped. There is "Good, Bad and Neutral", "Data and Model", "Themed Cell Styles", etc: Is there a way to interact with these groups? Like, can I delete an ...
ElRudi's user avatar
  • 414
4 votes
1 answer
791 views

Respond to SharePoint Survey through VBA

How can I respond to SharePoint surveys through VBA? I am trying to track a workbook's usage through a macro but I can't seem to figure it out or even the proper search terms to to search. Any ...
wizlog's user avatar
  • 13.3k
4 votes
2 answers
889 views

Word Find Everything Until A Particular Character

I'm creating a Word macro to automatically clean up output from a document generation system. I need to come up with a Word Wildcard Expression to select everything from a particular piece of text up ...
BlamKiwi's user avatar
  • 223
4 votes
1 answer
3k views

Delete the digital signature from a received Outlook message

My goal is to delete the digital signature in an Outlook message. My initial idea was to create a VBA script (which I have done below) to enumerate all attachments in the selected mail item and ...
Lakey's user avatar
  • 103
4 votes
1 answer
2k views

Excel VBA : SQL query handles error

I have SQL that I can use in Excel 2013 to get the info from the Access database and it works using the SQL directly in a connection, but now I want to run it from VBA instead so I can use some ...
Jim J's user avatar
  • 41
4 votes
1 answer
1k views

How do I get an event to fire when the slide changes in PowerPoint?

I already know of two supposed fixes, which I will list below, along with the reason they don't work for me. The first is to use the SlideShowNextSlide subroutine. The problem with this is that it ...
Jordan Longstaff's user avatar
3 votes
0 answers
448 views

Word VBA: Automating bookmark generation for individually numbered paragraphs

1. Problem summary This is my first time writing VBA for Word. I have multiple documents; each one is larger than 100 pp., with a plaintext index according to paragraph number. I am writing a script ...
Francis Regan's user avatar
3 votes
1 answer
286 views

Excel VBA: Application.Tranpose on an array gives Run-time error 438

I have a VBA code that gets data from a column of a structured table and puts it in a column of another structured table like this: Dim TopNTickers As Variant Dim NoOfTickers As Integer Dim ...
Kenny's user avatar
  • 55
3 votes
1 answer
2k views

MS Access - Grouped query based on MAX field

I am trying to build a SQL Query that takes the following data: +-------------+--------+---------+---------+--------+ | Primary Key | ID | Version | Class | Fruit? | +-------------+--------+----...
ExcelMania's user avatar
3 votes
0 answers
3k views

Updating List in Sharepoint Online (o365) via Excel/VBA

I am currently using VBA to update/create new sharepoint list items via SOAP. My IT dept has advised that they are migrating to SharePoint Online and the same code no longer works, I believe due to ...
Riss's user avatar
  • 31
3 votes
1 answer
589 views

How do I check if cmd.exe is disabled by administrator?

I am writing a VB script that checks if applications are available and accessible e.g. cmd.exe, powershell.exe and so forth. My script allows me to see if an application exists (it either works or ...
TheHidden's user avatar
  • 131
3 votes
2 answers
1k views

How do I reorder sheets in specific order, then alphabetically?

I need to reorder my sheets in a specific order, then if there are any left, do it alphabetically. I have the macro below to reorder them alphabetically. If i have sheets ""METALS", "SVOC", "GENCHEM"...
Jburkley's user avatar
3 votes
1 answer
990 views

VBA: show intellisense without pressing Ctrl+Space?

I've had a good search if this is possible and I doubt it but can anyone confirm: is there any way to have the IDE provide intellisense in the same way as say Visual Studio in the .Net family i.e. it'...
Absinthe's user avatar
  • 524
3 votes
1 answer
1k views

Data on excel from access database based on criteria in excel

I have a MS Access database to which an excel file is connected to view output. MS Query is used to interface and fetch data based on two conditions date & ID. I am unable to specifiy the ...
user666621's user avatar
3 votes
1 answer
1k views

Is there a way to automatically download files from Gmail or Google Drive

Disclaimer: Ouside of a little VBA knowledge I am not a programmer. I have several Web-Intelligence reports that are scheduled to automatically run for my company. Ideally, we would have the reports ...
Antareo's user avatar
  • 39
3 votes
0 answers
2k views

Keyboard Shortcut to Toggle Between Modules in Excel VBA Editor

I am working with multiple modules in Excel's Visual Basic editor. Is there a shortcut to toggle between different modules?
Concerned_Citizen's user avatar
3 votes
2 answers
87 views

VBA - reformatting a 3 column into 9

My data looks something like this, very very long vertically. #1, name1, number1 #2, name2, number2 #3, name3, number3 ... #2000, name2000, number2000 I want to reformat into 2 or 3 sets of column ...
Panupat's user avatar
  • 131
3 votes
2 answers
330 views

Excel 2013 VBA programming

I'll start off my saying I'm trying to save time for a family member who is doing this program manually. Sheet 1 Column A is a start date Column B is a projected start date Column E is a Task Name. ...
James's user avatar
  • 31
3 votes
1 answer
471 views

Expanding a cell formula resolving all its references (precedents)

In Excel I have a cell containing a formula referencing other cells, which reference other cells and so on... forming a large tree of references. I'd like to substitute recursively all the occurrences ...
user339194's user avatar
3 votes
1 answer
2k views

Excel VBA not working when "enable editing"

I'm not sure if this is the right place to post this but I'm having issues with excel VBA. I sent a worksheet with custom VBA attached to an email. Once the user downloads the file, it open in excel ...
user avatar
3 votes
1 answer
752 views

How to automate transforming a table into a matrix

I've been looking for a way to automate transforming data in an Excel table into a matrix. For example, from the left table into the matrix on the right, as shown in the following image: Apparently ...
d_zeratul's user avatar
3 votes
1 answer
4k views

Turning off "Drag Fill Series" in Excel

I am ideally looking to only turn off the drag fill series functionality. I only want the user of my sheet to be able to drag COPY down. I turned the feature off in settings, which disable ALL drag ...
Koto's user avatar
  • 29
3 votes
1 answer
2k views

Edit date field code on multiple Word Documents

I have multiple word documents that have a date field code displaying the current date. I need a way to modify each document so that it shows the CreateDate field instead of Date. The format for each ...
Sam's user avatar
  • 31
3 votes
1 answer
4k views

How to have a cell calculate only once

I have cell N29 calculating some values based on streaming data. Once a condition is met in cell Q29, the calculation or final value should be passed to cell O29 and no longer calculate in either cell....
Marco's user avatar
  • 31
3 votes
1 answer
1k views

How to remove a macro button added by customized ribbon in home tab?

I have added a macro button in an excel sheet by customize ribbon and have assigned some VBA code to it to do some particular task. The problem is that when I open any new workbook, Excel shows that ...
ramji's user avatar
  • 171
2 votes
1 answer
117 views

Bubble Sort (or Similar) Excel VBA with single and multivariable criteria: Solve for lowest sum

Long time lurker first time poster. I'm working on an Excel project to solve for the best (lowest value) combination of vendors and achieve full criteria coverage. The exercise is fairly simple for 95%...
Nate Z's user avatar
  • 21
2 votes
0 answers
41 views

Why does certain data imported from Word into Excel have yellow font, but not in Word?

Students fill out some tables in Word, and they must occasionally use a certain color font to get full credit. I'm using VBA to import their data and the color of their font from their submitted ...
Starnes Student's user avatar
2 votes
0 answers
204 views

Comparing one street address with a column of street addresses to find a match

I have two data sources with street address names, cities, and zips that I'm trying to find which addresses have the highest match percentages and return the maximum value. I have a VBA code that ...
Iyin's user avatar
  • 21
2 votes
0 answers
301 views

Excel: Multiple Selections in one drop down/one cell possible--perhaps using a listbox?

The current problem I have has to do with tagging multiple categories to an a list of items in Excel. A rough example is shown below, with the second column being the CONCAT column that takes in data ...
Ender_Bee's user avatar
2 votes
1 answer
2k views

Excel macros won't run from shapes or buttons

Using Excel 365. My workbook has macros which are linked to buttons or shapes on several worksheets. The macros work if I run them from the Macros dialog, or the VBA editor, but when I press a button ...
Shawn V. Wilson's user avatar
2 votes
0 answers
98 views

VBA code to move unique values from one Excel document to another Excel document with several sheets

I'm a total noob and basically don't know any VBA but I would be grateful if someone could help me out! I try to be as clear as possible. Every month I download an Excel file from Dynamics 365 (with ...
QuarterlyReport's user avatar
2 votes
0 answers
110 views

How to auto font like Word

In MS Word, if you type in Japanese, the font automatically changes to Japanese font such as MS Mincho or MS Gothic, depend on your default asian font. Then, if you type non-Japanese words, the font ...
user avatar
2 votes
2 answers
474 views

When was a VBA Macro last modified

I want to tell when was my macro was was last used. I have a macro that updates all the time and it's on different computers, so from time to time it's harder to track whichever of the macros is the ...
AG9's user avatar
  • 23
2 votes
0 answers
645 views

VBA - screen brightness self increase/decrease

The Problem: Screen brightness of my laptop randomly decreases and then slowly increases back. This has happened since I've used a macro that fades my User Form in-and-out. I regretted even using ...
SofiaEd's user avatar
  • 187
2 votes
0 answers
1k views

Insert data to database using Excel VBA is not working

I have a macro that will upload data from multiple workbooks to the database. Table will differs based on what type of value/data being inserted. I have there tables. I can insert value in the first ...
user10236952's user avatar
2 votes
1 answer
1k 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 ...
tincanfury's user avatar
2 votes
1 answer
1k views

How do I make Excel tab through merged cells in a protected sheet?

I am having a problem with how tab selection in an Excel sheet behaves on merged cells when the sheet is protected versus when it is unprotected. I have a merged cell that is two rows high. When the ...
MackM's user avatar
  • 230
2 votes
2 answers
3k views

Replace WORD text for specific cell value in Excel using VBA

I am kind of new here and I am also new to VBA. I need to replace a specific cell value in a WORD document. I have the replacing part of the code done, but only for a specific text. I need to replace ...
Ricardo Albuquerque's user avatar
2 votes
2 answers
655 views

Extracting numbers with spaces from excel using VBA

Need to extract numbers from the following text with spaces between numbers using VBA, possibly. Units : 1.00, Code: '99213', M1: '25',Comments: 'Records do not include documentation of an ...
Ryan Red's user avatar
2 votes
1 answer
341 views

How to change specific table in Word 2016 using VBA

I'm just start using VBA because I want to arrange the width of my table. After 2 hours I found this one works for me but the Document.Tables will apply this to all tables in document. Sub ...
Kevin K's user avatar
  • 21
2 votes
0 answers
113 views

Limit available printers for a MS Word Document, or define a "Default printer" in a particular document

I've a lot of printers (or specific printer's queue with particular setup for each queue) configured on my PC. Each have a unique "Printer Queue Name". I work with a software which generates Word ...
Vivien G.'s user avatar
2 votes
1 answer
1k views

Sending specific email based on cell values in Excel 2016?

Is there a more efficient way to send email reminders to a user based on a cell value that changes frequently? Here's the code of what I'm working on so that you guys could understand the context of ...
Wen Yao Wen Yao's user avatar
2 votes
0 answers
425 views

Newly opened Excel not counted on Workbooks.Count

I have a VBA macro that waits for another application to generate a new Workbook, however, as I run Workbooks.Count it doesn't count the newly generated file. It seems that the new Workbook opens on ...
Serveira's user avatar
2 votes
2 answers
2k views

How to hide Excel rows based on the criterion all cells in multiple, non-consecutive columns in that row are blank

In Excel, how can I hide rows if and only if all cells in multiple, non-consecutive columns in the row are blank? My worksheet has about 300 columns, so I cannot individually click on every other one ...
Claire's user avatar
  • 21
2 votes
1 answer
1k views

My date format scramble between italian to english VBA word excel

I did a macro to extract a date from a word document, and put in excel. I have a date picker content control in word. My locale in my PC is set to italian DD/MM/YYYY, my date picker word locale is set ...
user2748576's user avatar
2 votes
2 answers
174 views

Removing Duplicates Across 3K Rows, 9 Columns

I have an Excel 2010 table of 3,800+. I would like to identify duplicates across 6 columns, many with text, some with IP addresses and hostnames, so that accurate data is reflected. I've tried the old ...
KMG's user avatar
  • 21
2 votes
1 answer
3k views

VBA Import and map cells to specific cells

Am very new to the VBA world so i am struggling a bit here to figure this out. So i would like to import another excel document into my worksheet. I have managed to figure that part out. Sub Import(...
Olivier Lim's user avatar
2 votes
1 answer
212 views

Where MS Word stores the list of synonyms?

Right-click on any word in MS Word presents a list of synonyms. Where is the complete list of all these words? Can I add my own words this list? Is this list accessible with VBA?
codeDom's user avatar
  • 185
2 votes
1 answer
883 views

How do you make values auto-increment in headers?

I've created a macro that adds a page at the end of a document and changes the title text in the Header. I want to be able to add multiple pages and have the letter in the title auto-increment: ...
ShemSeger's user avatar
  • 184
2 votes
1 answer
506 views

Delete graphic in Excel with VBA

In some of my worksheets I see pictures and Excel show me the names like "Grafik 4". Now I want to delet them automatically. I have 200 Excel files, always with the same picture and the same picture ...
Franz L.'s user avatar

1
2 3 4 5
31