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
1 answer
10 views

VBA to copy and paste Range Values is too slow

I'm using this code and it works just fine but it runs very slow. Does someone has a different approach for this? Sub CopyPaste() Dim sourcerange As Workbook Dim currentrange As Workbook Dim r As ...
Carlos Juarez's user avatar
0 votes
0 answers
22 views

Excel formula or VBA to create simple coversheet calendar from multiple worksheets

I have several worksheets that I want to create a simple calendar with. Every month I will be creating a new workbook. Detailed operating information is on each worksheet, name of the worksheet is ...
Tina's user avatar
  • 23
1 vote
0 answers
21 views

How to cut row from sheet1 and paste onto sheet2 - excel

i need help. I have multiple sheets. Rejected Candidates Interested Candidates Candidate Track Onboarding Track Now I have these formulas: =CHOOSECOLS(FILTER(Interested_Candidates,...
Nik's user avatar
  • 11
2 votes
1 answer
148 views

Avoid repetition in writing an expression in VBA Excel coding

I have written a code in VBA Excel, a part of which is repeated several times in the entire code. for example: sheets("A").range("A1").select ... sheets("A").range("...
First Last's user avatar
1 vote
1 answer
49 views

Outlook VBA - linked image in ReplyAll mailitem created from Custom from template not displaying

The below code creates a mailitem from a custom Outlook Form Template and a ReplyAll mailitem and appends the ReplyAll mailitem to the Template mailitem. However, the image icon from the Outlook form ...
sifar's user avatar
  • 111
1 vote
1 answer
32 views

Calculation of mathematical text in textbox

Is there a function to calculate the mathematical text in the text box in VBA? For example, can we calculate the expression 1+2 entered in the text box? I have used the calculate option in Word using ...
First Last's user avatar
1 vote
1 answer
39 views

Excel Sheet save as pdf

I have a VBA macro that saves an excel file to the same directory as it is in. This performs well and as expected. What I want to do is to save the file as a PDF. I have tried various bits of code but ...
Alan-53's user avatar
  • 33
2 votes
2 answers
36 views

Macro to find and move specific cells

I need a macro that finds each cell in (Excel) column A that begins with an * (asterisk plus space) and moves it one cell to the right and one cell up. Then goes to the next * cell in column A and ...
Ash Grove's user avatar
1 vote
0 answers
32 views

Excel VBA Data Validation to check if data validation in the table has failed

My below code does two things wrong. First, it checks for data validation for all the cells in the sheet even if those cells are outside the DataBodyRange of the table and shows MsgBox "Failed&...
Jawad's user avatar
  • 111
0 votes
1 answer
31 views

Why is conditional formatting in an .xlsm not printing?

I have an xlsm workbook that colours cell backgrounds based on comparison to adjacent worksheets. The adjacency is always 1 to the left, irrespective of whether sheets are inserted or deleted. The ...
J Collins's user avatar
  • 558
0 votes
0 answers
26 views

Hardcode Values from Formula in VBA

I work at a library and I write VBA Excel scripts for librarians from time to time to automate tasks, ones revolving around gleaning info from reports usually. I have a data-loving librarian that ...
Jordan's user avatar
  • 37
1 vote
1 answer
28 views

Create a macro on Word to save with current name at a different location

I have a Windows 10 PC. Basically I have a similar problem to this: How can I save a file to two locations at the same time?, but just the opposite. I have files on a USB stick, and I want them to be ...
new editor's user avatar
0 votes
1 answer
36 views

Excel VBA - Copy data from multiple sheets into a table

I'd like to be able to copy data from multiple sheets into a table without deleting the table's formatting. The data being copied from each sheet will always contain 6 columns But the number of rows ...
Nev's user avatar
  • 1
0 votes
0 answers
14 views

Error in duplicate record in Access 2010 [duplicate]

I should work with a database into the Access 2010 recently. It has few Tables, a few Queries based on their tables and finally a Form. The Form has a button for duplication records. When I click the ...
Kasy's user avatar
  • 1
1 vote
1 answer
125 views

Excel VBA - add date and time to a file name as FILENAME_MMDDYY_HHMMSS

A few weeks ago I posted about using VBA To prompt me to add a file name when saving an excel file using a macro. Thank you for all the help. I got it to work!! Now I have another similar question. ...
Kirk Thompson's user avatar
0 votes
0 answers
31 views

Prevent VBA from duplicating dropdown list selections when entering manual text

I'm using a VBA code for a dropdown list with multiple options in Excel, but when I enter text manually in a cell that already contains one or more selected options, the code duplicates the previous ...
Tom's user avatar
  • 1
0 votes
0 answers
59 views

don't want to automatically add "@" symbol in excel formula

I am adding a formula using VBA in a excel cell and excel automatically adding a "@" symbol after the "=" sign. this is the vba code. It is putting the whole string as formula but ...
Ayan Bhunia's user avatar
0 votes
2 answers
43 views

Cut entire cell, based on specific text in cell, and paste to new cell

I have a six-column table in excel that I am using with a barcode scanner. We are scanning custom QR codes that display text into each cell. The scan starts with scanning the employee's QR code on ...
btwolfe's user avatar
3 votes
1 answer
152 views

How to cross join in Excel VBA

I want to cross join two columns from a sheet and paste the result in another sheet using VBA. Cross join of column A and B from Sheet1 and paste result into Sheet2. I found two answers but not able ...
Ayan Bhunia's user avatar
0 votes
1 answer
25 views

Change text color of URL in Word VBA

After the URL is displayed beside the hyperlink, the formatting from the hyperlink is applied. Is there a way to remove the blue, bolding and underline formatting for the URL. Current format: My ...
Dingleberry's user avatar
0 votes
1 answer
23 views

look for empty cell between non empty cells in one row and then put 0

enter image description here enter image description here A B C abc 30 40 def 4646 ghi 45 3234 So, I want to write a macro code where it takes all three columns into consideration at once....
Aadya's user avatar
  • 1
0 votes
2 answers
52 views

Insert URLs in plaintext after each hyperlink in MS Word using VBA

I would like to automatically insert the URL for each hyperlink in a word document beside the linked text. For example instead of having: my hyperlinked text It should be: my hyperlinked text (https://...
Dingleberry's user avatar
0 votes
1 answer
72 views

Set default zoom in Excel on a new sheet

I have set zoom level when new workbook is open with this code: Private Sub Workbook_Open() ActiveWindow.Zoom = 109 End Sub How to I set custom zoom on every new sheet that's created in that ...
IGRACH's user avatar
  • 475
1 vote
1 answer
58 views

How to fix vba type mismatch?

I have a compile error message byref argument type mismatch pointing to rg1 where the HTML is. Could you please help? Sub email_multi_ranges() Dim OutApp As Object Dim OutMail As Object Dim rgl As ...
tammy's user avatar
  • 13
0 votes
0 answers
42 views

VBA: Compile Error: Syntax Error when trying to use Cell.Replace VBA code

Hi I'm new to VBA and I've created a code to format my Table however I receive an error "Compile Error: Syntax Error" when trying to run it. I have tried to look at the code but I can't seem ...
slimbu2020's user avatar
0 votes
1 answer
51 views

Excel: Extracting the row name and column name corresponding to the MAX value in my DataTable

In cell K1=MAX(J7:AM36) I have the maximum value of the data table, I want to extract the corresponding StopLoss% ( This is my column headers, they are %) to Cell K2 and also my TakeProfit% ( This is ...
Steven's user avatar
  • 3
0 votes
0 answers
23 views

Excel: Conditional Formatting or Macro to delete/change information in one cell based on condition in another

I have a conditional format in place to highlight text in columns A - I as information is entered in column L. I would like to now delete or change the information in adjacent cells to be blank or 0. ...
Tina's user avatar
  • 23
0 votes
0 answers
40 views

cannot find next item in findNext loop

I loop through Items in an array raArray which I want to find in a Table. However, I cannot seem to get the code to work to find the next result for the array element with FindNext. Either I get stuck ...
user1769136's user avatar
0 votes
1 answer
162 views

Update a field in other records based on the value of same field in a record automatically

I want to transfer the contents (value) of a field in an Access form by VBA to its previous and next records, while I am still in the current record. Could be said I want to copy it to the same field ...
Kasra's user avatar
  • 39
0 votes
1 answer
34 views

continue searching for string in Table until no more results are found then go to next search term

I have a working code that allows me to find a string in a table and returns the value of an adjacent cell (adopted from a different code) and writes it to an array Dim raArray As Range Dim iC As Long ...
user1769136's user avatar
0 votes
0 answers
21 views

write avg subtotal in filtered list "in-line" with month

I have a list of values, where want to calculate the average for each month based on the subtotal(101) function. Each month has a different amount of values (e.g. 5 values for March, 17 for July). (...
user1769136's user avatar
1 vote
1 answer
34 views

Custom Information Message for user based on another cell value

I am busy with an optimization spreadsheet which needs to display an information message, maybe similar to the Input Message for data validation (but I am open to suggestions). This message will be ...
IzakG's user avatar
  • 21
1 vote
0 answers
24 views

Clicking on an unlocked cell on a protected sheet is unprotecting the sheet

I have a workbook with multiple sheets. There are unlocked and locked cells. I have a macro to protect all sheets. After I run the macro and all sheets are protected, when I then click on a cell ...
Ana's user avatar
  • 11
2 votes
0 answers
29 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
0 votes
1 answer
188 views

Reoccurring Out of Office Every Other Week Outlook

In Outlook, is it possible to set a an out of office automatic reply every other week on the same day? e.g. every other Monday. I see a solution here using headers for every week: https://answers....
sushi's user avatar
  • 103
1 vote
1 answer
69 views

Excel VBA - Copy a formula result to a cell in another sheet + add succesive formula results in consecutive rows each time the formula is recalculated

I am running a partially randomize set of data and trying to find the best solutions depending on certain parameter changes. I need to "record" certain solutions and then compare different ...
Bao bab's user avatar
  • 11
0 votes
0 answers
306 views

How to import multiple csv-files in Excel at once with VBA

I am trying to import multiple csv-files within the same directory into my Excel sheet using VBA. The following code is working very well with just one csv-file. But I lack the knowledge to adapt my ...
Caroline's user avatar
1 vote
0 answers
34 views

Creating .txt files from excel columns with description [closed]

I am trying to create .txt files that have the following: Txt file name would be cell(A1) Content of the txt file needs to be the content of cell (B1) Repeat throughout the column I am new to VBA and ...
Abdullah Al Jaja's user avatar
0 votes
1 answer
148 views

Merge PowerPoint Presentations Slide By Slide as Animation

I have 12 PowerPoint presentations (one for each month) with same number of slides and each slide contains similar reporting info/trends/tables for the corresponding month. I would like to merge all ...
NotepadPlusPlus PRO's user avatar
0 votes
0 answers
66 views

How to use cmd to move multiple files via vba code

i would like to use cmd to move multiple files (selected files) from one folder to another folder through VBA code. I wrote successly the vba code to move one file by cmd and then i use the loop to ...
Bảo Nhi's user avatar
0 votes
0 answers
37 views

Disadvantages of checking for invalid values in a textbox

I am making a userform where I want to perform a regression analysis from the input data for four functions fi(x), which are recorded in each of the corresponding textboxes. To check if the input ...
Camila Sanchez's user avatar
1 vote
1 answer
196 views

Word 365 Allow Macros to run on Read-Only/Protected View

I am attempting to upgrade our company to Microsoft 365 x86 from Office 2019x86. We are currently stuck on 32bit because our electronically controlled document process currently has VBA macros that ...
Acurze's user avatar
  • 11
0 votes
2 answers
172 views

vba TRUE or FALSE text from Clipboard recognised as boolean by Excel

I have table with one of the column (let say column Code) has text TRUE in it. But, when I copy it to excel, the data become boolen so my vlookup (that search text TRUE from column code) become an ...
Loki Sinaw's user avatar
0 votes
1 answer
544 views

How do I stack multiple columns into one column in Excel 365 Mac

I currently have my data in different columns after using a Text To Columns feature. Now what I want to do is to put them all into one column. Can you please advise what formula to use or is there a ...
Sandee's user avatar
  • 1
0 votes
0 answers
39 views

Is there a way with VBA to hide or disable Show Hidden Excel Power Pivot?

Is there a way with VBA to hide or disable "Show Hidden" button in Power Pivot? So no one can see the raw data.
4dr1's user avatar
  • 1
0 votes
0 answers
563 views

VBA - paste multiple Excel ranges into Outlook as images

Trying to create an Outlook email that has Excel ranges pasted as jpg in the email, along with text before and after. Something like: Text Image 1 Image 2 More Text However, I cannot figure out how to ...
rebca912's user avatar
0 votes
1 answer
21 views

R studio, Excel, XLS files

I have 20 excel (.XLS) files. Each excel contains 13 Sheets. All of these excel are in proper format. I wanted to extract sheet no.10 from each excel and paste the data into an Excel sheet. I want ...
siri's user avatar
  • 3
0 votes
0 answers
315 views

Is there any way to open multiple hyperlinks at once in Excel?

I a have created list of email hyperlinks in my spreadsheet using only hyperlink formula (not VBA) with email content based on value of a few defined cells. =HYPERLINK("mailto:"&F16 &...
fleexio's user avatar
0 votes
0 answers
28 views

Open, copy and paste cells from multiple workbook to one workbook to one sheet

I have 15 excel files with two sheet. From each, cells A1:A48 should be copied from the first page to a new file in the sheet1, in order to the next column from the first cell. It only copies from 14 ...
Dragan's user avatar
  • 1
0 votes
0 answers
54 views

Multi Sheet Inventory that allows for an ordered quantity to be entered, once product delivered, the stock column updates to existing + ordered

I've been breaking my head over this one. I have an inventory that has 10 sheets and a 500 different items. Stock entry To enter data, you can select the manufacturer (Lieferant), the page on which ...
LukaV's user avatar
  • 1

1
2 3 4 5
73