Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
12 views

VBA: Row being pasted needs to all be in the same row, not look at last blank in that column

The VBA code I have currently pastes data into the last blank cell "End (x1Up). But in column C, there is often blank cells, so I need it to look column As last blank to know where it is pasting. ...
Stewy's user avatar
  • 1
0 votes
0 answers
28 views

ByVal target range returned is in unexpected format

The target.address variable that is passed, is $127:$127. In terms of range, what does it mean? Private Sub Worksheet_Change(ByVal target As Excel.Range) If r Is Nothing Then Set r = New Revenues ...
TechFanDan's user avatar
0 votes
0 answers
34 views

It takes a long time to load a vb.net program from a vba shell and we do it multiple times. Is there a way to speed this up?

I have an accounting application that runs a stripped down version of VBA. When I perform more indepth functions to a data entry, I will load a VB.net (WIndows forms) program sending relevant ...
Arnie's user avatar
  • 1
0 votes
0 answers
29 views

Excel VBA to list Sheets in selected Workbook and copy listed Sheets to end of Main Workbook

I have a working VBA code present in a Main Workbook which is designed to browse and select Another Workbook and generate a list of names of all Worksheets present in the selected book in the Main ...
Shuaib Dawe's user avatar
0 votes
1 answer
73 views

I want my macro to find all words (in a certain unformatted document) that start with a certain string ("yyy") give these words a different formatting

I want to find all words (in a certain unformatted document) that start with a certain string ("yyy") and give these words a different formatting. The following VBA-code executes once and ...
Bert van der Saag's user avatar
0 votes
0 answers
30 views

Excel - Highlight Row of Selected cell

I want to highlight the row of the selected cell in any active workbook. How can I achieve my goal? I have experiences in highlighting selected row by using conditional formatting and change event. In ...
Jill's user avatar
  • 1
2 votes
1 answer
178 views

Incrementing number in a row each time I print

I need to increment a value by 1 in K1 each time I print sheet number 1, 2, etc. I used to have code that was saved and was working fine, but I lost it when I formatted the PC. It used to ask me the ...
Shiv's user avatar
  • 33
0 votes
0 answers
46 views

How to append multiple .csv into one .csv (not multiple sheets .xlsx)?

Looking to do something like this: Is there a script that can do that? I've tried searching and the scripts are either 404'ed or they merge them into a single .xlsx with multiple sheets.
Michael L's user avatar
0 votes
0 answers
30 views

Using VBA-JSON to retrieve the value of a key that is in an array

I'm trying to use VBA-JSON to parse a dump from Wiktionary. I gathered from the example here that if the key you are interested is in an array, you specify the index in parentheses starting from 1, ...
culp's user avatar
  • 35
0 votes
0 answers
9 views

Why isn't xlPasteFormat carrying conditional formatting to new workbook?

I"m trying to take a workbook with formulas for calculation and export it to a workbook that is value only. The use case is a scorecard for different items, so having the overall scores color ...
Patzy's user avatar
  • 1
1 vote
1 answer
34 views

Convert input box to pick column into number to apply to range

I would like to use the inputBox to pick a column by user and apply it to run on each row index but haven't had a luck. Its saying type mismatch. A lot of things to learn and lacking experience in ...
DongM's user avatar
  • 41
0 votes
0 answers
55 views

VBA - Search Website, Return Class Element Value

I've created a VBA Script to return a value from a class element value on a website, However this is not working in this particular element. I believe this may be due to the website requiring the page ...
nobody's user avatar
  • 1
0 votes
1 answer
41 views

Excel: Worksheet.Calculate causes UDF to run infinitely

I have written a udf returns an array that is inserted at the cell location. the udf can be long running as it reaches out to a rest service to fetch data from a database. so i added a button on my ...
mike01010's user avatar
  • 101
1 vote
1 answer
79 views

How do I get the full sql code for all queries in all MS Access databases of a folder?

I want to run RegEx on the full SQL code of hundreds of MS Access queries that I loop through with VBA over all Access databases that can be found in a folder. The "SQL" attribute of the ...
questionto42's user avatar
  • 2,431
0 votes
0 answers
30 views

Assigning Excel add-in macros to ribbon using a relative path

I am trying to create a basic Excel GUI for a Python software which uses Excel spreadsheets as inputs. I have managed to create a basic add-in with a macro which runs the Python code for me. To make ...
Sorade's user avatar
  • 101
0 votes
1 answer
38 views

"You can't modify the structure of table "xyz", because it is already in use by another person or process.", and the Access instance cannot be closed

While I changed some VBA code in MS Access to fill new columns that I added to an Access table, I struggled with a crashed instance that stayed open even if I clicked on "Close"/X. I ...
questionto42's user avatar
  • 2,431
0 votes
1 answer
74 views

Counting the number of selected messages in Outlook when Conversation mode is on using VBA

I need to count some mails in Outlook for Windows. There are some workarounds to do so, but the only real solution I found is to use a VBA script as described in this other question here: How can I ...
hanjo's user avatar
  • 1,211
1 vote
1 answer
59 views

How to Loop cluster / ranges horizontal to vertical via vba [closed]

Newbie here and would like to get a loop working in Microsoft excel. Basically, to arrange clusters / ranges from horizontal to vertical. I have tried transpose function but have not been successful ...
DongM's user avatar
  • 41
0 votes
0 answers
43 views

Linking columns on different sheets

I'm very new to VBA coding (only dabbling for this specific project), so I would really appreciate any advice on an issue I'm having. I'm attempting to independently link multiple column ranges on ...
thtrmus's user avatar
0 votes
0 answers
94 views

Need help to optimize my VBA code

What I'm trying to do is I want to copy the rows to each different type based on record type. Raw file tab - there are hundreds of thousands rows of data containing 6 different record types. PRPO TAB -...
user2251216's user avatar
4 votes
2 answers
306 views

VBA Macro runs successfully then freezes

I am trying to take data that was merged into one cell and retain the first 6 characters of that cell and move the remaining into the next column then proceed through the worksheet. I wrote the ...
Jessie Shepard's user avatar
1 vote
0 answers
24 views

Excel- Product cross reference to return amounts shipped vs received

I'm trying to create a tool that allows a data dump of shipping invoices from my company and invoices filed through the state. Then spit out a table where it's easy to see quantity variances. I have a ...
jcoucanna's user avatar
0 votes
1 answer
86 views

Formula to values once data is entered in another cell

I have columns with formula wherein the result will pop out once a data is entered in column O. Meaning at first these formulas look blank and Column O is like the trigger for the other data to pop ...
JAF's user avatar
  • 1
0 votes
2 answers
215 views

Excel macro to count cells by color and does not count merged cells as more than 1

How can I write a macro that will go through a range of cells and count the contents by color without it counting each individual cell within a group of merged cells. For instance, in the picture, I ...
Jessie Shepard's user avatar
0 votes
0 answers
23 views

Insert MODE.SNGL into a conditional formula pulling data from one worksheet to another

Windows 10 Excel 2019 I have a workbook with two worksheets, Product Data and Product List. The data in Product List is generated each time the formula I am looking for is run. The number of products ...
Bel's user avatar
  • 43
0 votes
1 answer
54 views

Excel VBA - Looping an IF( & VLOOKUP( starting with a partial string

Good day to an amazing community, I am trying to develop a macro to loop through two arrays. Here is an example of how the data is set up: Raw data is found in C4:C1500 $ data is found in D4:D1500 ...
RT2's user avatar
  • 1
0 votes
1 answer
231 views

Removing Content Control Quick Part in Microsoft Word

I have a VBA macro that will auto populate a document with content control quick parts that have blocks of text with other content controls within them. I'm attempting to write a VBA macro that will ...
churchizactiive's user avatar
0 votes
0 answers
33 views

Mentions affecting Regex Validation

I was wondering if anyone came across the issue with Regex validation in Microsoft Outlook when including mentions (i.e.,@Tony or @Jodie). The below code works fine when there is no mentions in the ...
churchizactiive's user avatar
1 vote
0 answers
73 views

Unique ID for Fields and Cross References in Microsoft Word

I am working with a collaborative Microsoft Word Document with Figures and Tables cross referenced throughout the document. For instance, there are 75 figures linked with Captions. We have cross ...
NW_Photo_Laureate's user avatar
1 vote
1 answer
138 views

IN VBA, How to sum hours and minutes exceeding 24 in memory (not in ranges of excel)

I'm getting some data in the format of text(like for example "12:47" that means 12 hours and 47 minutes) from a URL document and calculating some parameters like overtime work, shortages and ...
alireza Seraj's user avatar
0 votes
0 answers
29 views

Automatic change of keyboard language in a worksheet in Microsoft Excel

In Microsoft Excel, and using visual basic, how to set a default language for different columns? For example, columns A & C should be set to English by default and columns B & D to Persian. ...
farshid's user avatar
0 votes
0 answers
93 views

VBA Excel Multiple files saved in newly created folder named with text in cells range and date

I am trying to create a folder and save as copy of my workbook in this folder for all the filled cells in range B11-B14 of my workbook. I managed to create the folder and the file with the correct ...
Caroline's user avatar
0 votes
1 answer
445 views

Excel Macro Code Disappearing in Network Trusted Location

This problem -may- have started around when I switched from Office 2019 to 365, however I've been doing so much upgrades lately (windows 11, server 2022, etc) that my memory is foggy. Over the past 6 ...
Ethan Wade's user avatar
2 votes
1 answer
142 views

Excel VBA Else Without If Error -- I can't seem to find where the error is?

I am configuring a long IF statement, where if the financial period is the same, it merges the cells together under the same period header, and if not, it creates a new header with the new period name....
Matt's user avatar
  • 23
0 votes
0 answers
76 views

Filtering a Table based on a Cell Reference in another workbook, then copying it

I am trying to filter a table based on a cell in another workbook, the reference for the filter would be in workbook "ReportWB" and the "Project Summary Detail" sheet, cell "...
Shayne's user avatar
  • 1
0 votes
0 answers
18 views

Inserting Today's Date In A Cell If Other Cell Values Are Changed or Added using VBA

So I have this spreadsheet that I share with my Team, and I'm looking for a way to have a Today's date put in a cell, everytime there's a change in the worksheet. I found this coding, which is working,...
Marta Hoffmann's user avatar
1 vote
0 answers
188 views

How to run a Word macro from the command line?

I'm trying to save and close all open Word files (to start I only target one of them). The macro I made works when ran from Word (clicking "Execute"), but it won't run when called from the ...
TryingToLearn's user avatar
0 votes
0 answers
160 views

Excel VBA: Export/save won’t work correctly

(Hope the formatting is okay. I’m doing this on my phone, so it’s hard to tell.) So, I’m trying to create some VBA to automate the clean up process of data I get from my field crews. Everything below ...
X-Cell's user avatar
  • 25
1 vote
2 answers
218 views

Excel, update cells when clicking on another cell

I have tried a few different bits of VBA found here on SuperUser but not able to get it to work. I am trying to update a cell when I just click on another cell. I have data in A43:A54, it's a list of ...
Dean Smith's user avatar
0 votes
1 answer
93 views

Replace with wildcards in Excel or batch edit some wrapping formula

I'm only trying to delete some CONCATENATE() function from some formulas in Excel. What I have; here 'Something' could be a lot of things (digits, <, >, texts, etc… CONCATENATE("Something = ...
Seba99's user avatar
  • 101
0 votes
0 answers
51 views

extract VBA userform from corrupted word docm

I have a userform in word built over 10+ years. Today Word chose to crash the normal.docm file and the VBA project became unreadable. I have used python scripts to extract the code, but I don't have ...
MyICQ's user avatar
  • 242
0 votes
0 answers
138 views

Highlighting duplicates in Excel with VBA, multiple sheets

I have a workbook set up with a sheet for every month and then a summary sheet, so 13 sheets total. Each sheet, other than my summary page, have two sets of tables set up. A table for each week in ...
Aisha Stayer's user avatar
1 vote
1 answer
438 views

Macro for using Goal Seek over a range of cells

I'm trying to automate the GoalSeek function over a range of cells. Each cell in Columns I and J calculates a quantity of interest using two different methods, and the results must agree. Each cell in ...
Alan's user avatar
  • 11
0 votes
1 answer
790 views

Any way to allow multiple people to edit a coauthored, password protected workbook, at the same time?

I am currently working on a sheet that I want select people to have full access to, while everyone else without the password for the sheet cannot. I can do mediocre and overly complicated solutions ...
Thomas Wohllaib's user avatar
0 votes
1 answer
491 views

VBA - Copy Visible cells not selecting everything

I have a very long macro that I've written that looks at a report sheet, breaks it down by many different criteria (putting some of the results on different sheets), and does hundreds of calculations. ...
Jordan's user avatar
  • 37
1 vote
1 answer
36 views

Formulas corresponding to the correct table in my sheet, vba. Multiple tables across multiple sheets

I am setting up a cycle count sheet using VBA. I am having trouble with the formulas in my tables only referring to the first table in the sheet for the input values. For example, I have 4 tables per ...
Aisha Stayer's user avatar
1 vote
3 answers
138 views

Convert an Excel table from one structure to the other

Original table I have this table in Excel or LibreOffice. Unit number Type Name 1 Object Top 1 Object Bottom 1 Object Left 1 Object Right 1 Object Back 1 Object Front 1 Property Right-Fixed 1 ...
Megidd's user avatar
  • 270
0 votes
1 answer
149 views

Excel for Microsoft 365: Obtaining the Default Column Width

I am using VBA in Excel for Microsoft 365. I wish to obtain the default column width and store it in a Double variable. This is driven by the desire to not hardcode it. I have attempted to obtain this ...
Dave's user avatar
  • 1,029
0 votes
1 answer
111 views

Evaluate returning #VALUE? when trying to calculate large VSTACK

I am working on a project that is pulling a bunch of spilled data across a ton of sheets that are all in the same spot as the sheets are based off of a template. Using the name manager I was able to ...
Thomas Wohllaib's user avatar
2 votes
1 answer
83 views

MS Access replace function is not giving the expected result

I am concatenating two fields, however in some cases the second field begins with \, but not always. I'm trying to remove the possible extraneous \ using replace. stDigitalFolderLocation = ...
Ali Kayn's user avatar

1
2 3 4 5
76