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
2answers
279 views

Excel 2013: VBA to copy formula from one cell to the next

I need to copy a formula from Cell A3 to B3 in Excel, using a button to run below macro: Sub Copy() Range("A3").Select ActiveCell.Offset(0, 1).Formula = ActiveCell.Formula End Sub Then with ...
-1
votes
1answer
49 views

How to print multiple PDFs of graph controlled by dropdown list using VBA?

I have an Excel worksheet which generates a combination chart to show trend data on 49 manufacturing work cells. The chart source data is based on cells which contain a large number of formulas (...
0
votes
1answer
89 views

Is there a way to link workbook data without getting REF errors when a row is deleted?

I currently have two workbooks, workbook 1 and workbook 2. Workbook 1 - Sheet 1 is directly linking data to Workbook 2 - sheet 1. I am linking by inputting the below formula into workbook 2. ='[...
0
votes
0answers
73 views

Scheduled and Recurring Email using a template

My macro works but the email is not from my saved template. Private Sub Application_Reminder(ByVal Item As Object) Dim objMsg As MailItem Set objMsg = Application.CreateItemFromTemplate("C:\Users\...
0
votes
0answers
215 views

Word VBA: Document_open() macros execute on manual open but not when called with a keyboard shortcut

Thanks, @Albin...Sorry, I'm new. If I have a document with code in the Document_Open() section of the ThisDoc section of the document Project in VBA, the code works fine when I open the document ...
0
votes
1answer
32 views

Copying cell from one sheet to another without formatting

probably a simple one to your geniuses however I need a fresh pair of eyes as I've been on this a while and can't see my error. I'm merely wanting to copy the contents of a cell from one cell to ...
0
votes
1answer
50 views

Copying only certain cells from a row to another worksheet

I have a workbook that has a large number of sheets designed to help my team manage their workload more efficiently. When someone requests a job to be done, a row is added to a sheet called 'pending ...
0
votes
1answer
41 views

Input data from one workbook form into another workbooks worksheet

What I am trying to achieve: I have one workbook with an application form to request additional training. A person fills out all the cells on the form and clicks submit. I then want all the data ...
0
votes
2answers
190 views

ActiveCell.Value = Time vba without seconds

I have a "timesheet" macro for clock in and clock out times for employees to use at work. The macro I have is this: ActiveCell.Value = Time ActiveCell.NumberFormat = "h:mm AM/PM" It works well and ...
0
votes
1answer
61 views

Excel auto new sheet with column copy and today's date

I want to write a VBA routine that would "daily" create a new sheet give that new sheet a name of the form DD.MM.YY (with leading zeroes), based on today’s date (for example, 25.07.18) copy the ...
0
votes
0answers
105 views

WorkSheet_change event doesn't fire on pressing enter, but tab works on drop-down change

I have wrote code in worksheet_change event but this event doesn't fire when I press enter but It works well on pressing tab. I have drop-down in excel worksheet cell. Could someone please find ...
0
votes
1answer
39 views

Hotel software opens E-Mail Window in Outlook with generated text - how to change it automaticly to html or trigger a vba script?

My situation: A hotel managment software generates a text and opens a "New E-Mail" Window in Outlook with that text preset. However, I need the E-Mail to be in HTML format, apply some formatting and ...
1
vote
1answer
148 views

Auto attach a file to a specifc email template

Every morning i have to update a file with some data and then send it to people and its getting a bit laborious having to attach the same file over and over again each day. I have a template with the ...
0
votes
0answers
48 views

Filter outlook Sent Folder by last month and get the count

I've been trying to filter my outlook sent folder in Word to get the count of the total emails from last month. ' Connect to outlook Dim outlook As Object Dim NumEmails As Long Dim name_space As ...
0
votes
1answer
79 views

Extract distinct row values from a sheet to another sheet based on max dates per unique rows

I want to extract rows based on max date or max B per unique values of col A and col c. Doesn't matter if it is vba or excel formula. Help please. Old Sheet New Sheet [2
0
votes
1answer
44 views

How to use VBA .SaveAs by copying a number from a cell in the spreadsheet retaining a particular number format?

In Cell A1, I have the number (56,000), which is -56000 (negative fifty-six thousand), formatted as Accounting. However, whenever I use VBA to include that cell value in the filename, it saves it as "...
0
votes
1answer
113 views

Weird VLOOKUP issue in a macro heavy worksheet

I have quite a weird issue with a workbook I built that is very macro dependent. It centers around a simple VLOOKUP(). Currently my macro creates a line item on one sheet (Sheet A), then copies said ...
1
vote
0answers
272 views

Prevent losing a digital Signature when a document is saved?

The question What is an effective work-around to prevent a Digital Signature dropping from a file when it's saved? Or, What would be an efficient way to replicate saving data to a Macro Enabled MS ...
0
votes
1answer
25 views

Copy data from one sheet's cell to multiple cells in another sheet

I have this database where I store sales. I can find particular sales by filtering. I would like to have a button that then regenerates the sales as "receipts" in another sheet. This is my code for ...
1
vote
1answer
66 views

Error sending automated email

I have a shared workbook which has a column that uses a data validation list. If YES is selected I'd like it to send an email to a certain department to prompt them to look at the workbook. I've ...
2
votes
1answer
233 views

Modify VB code in MS Word to change image text-wrapping

In this code for image resizing: Sub resize() Dim i As Long With ActiveDocument For i = 1 To .InlineShapes.Count With .InlineShapes(i) .ScaleHeight = 50 .ScaleWidth =...
0
votes
1answer
138 views

VBA code for subtraction of subsequent numbers in a list from the first value

I have a list of numbers. I want to use the first number in the list as a starting value and subtract the subsequent numbers from it, using VBA. I have made several unsuccessful attempts: Function ...
0
votes
0answers
74 views

How to unset focus/make cursor disappear in Access?

I have a form in Access; when you put the cursor in a text box or combo box, and then click a blank area, it doesn't go away. Just vexing. I want it to respond like the message field I'm typing in now....
1
vote
2answers
114 views

Returning a value that is CLOSEST to some value found within a large range of data

I have one column A1:A20 whose values I need to find within a large table of data. For the purposes of this example, I'll say that the data table ranges from D1:Z25. Ideally, I would have an Excel ...
3
votes
1answer
314 views

Window Resize event not triggering when snapping windows to the edge of the screen with the mouse

This question is in relation to this Stack Overflow question, but I felt the issue at heart is less about programming and more about the limitations of the program, which is why I'm asking on here. I'...
0
votes
2answers
58 views

How do I automate upper case formatting for select columns in excel with VBA?

I am trying to automate formatting keyed in text into uppercase for Columns B and C and I am having trouble in setting column targets correctly. I found this piece of code on an excel help forum but ...
0
votes
0answers
44 views

VBA Excel Modeless Userform - unable to interact with another workbook

I have tried a search but I am unsure as to what to search for. I have a modeless Userform but when I try to manually interact another workbook it doesn't react until I click on the form then the ...
2
votes
1answer
231 views

Dynamic row and column size for Text to Columns VBA code

I export CSV reports which often have around 200-5000 rows or 30-60 columns. Using the record a macro function I recorded a macro that goes through the Text to Columns Wizard, the resulting macro is ...
0
votes
1answer
48 views

How to click a cell in A5:A10 in “Sheet 2” and have that clicked cell value be inputted in cell C3 in “Sheet 1”

I have a workbook with two sheets, labeled Sheet 1 and Sheet 2. In Sheet 2 I have a range A5:A10. I'd like to be able to click a cell in that range and have its contents be inputted into a cell in ...
0
votes
1answer
373 views

Excel VBA - View Hide specific rows depending on value in another row

I've been struggling to try and get anything to work and hoping someone might have an idea. If C5 has a value I Need Rows 6, 106 and 107 to become visible. I then need it to check if C6 has a value ...
0
votes
1answer
54 views

Excel VBA: Indexing a collection of SpecialCells

I've noticed that if you apply the SpecialCells method to a range, and then index the elements of the resulting collection, what is returned are all the elements of the original range, not of the new ...
1
vote
1answer
75 views

Index/Match for an entire table rather than a single column

I am looking for a formula that will locate an exact match of a value somewhere within a table of given values. Table d,e,f contains the differences between values in columns a and b, but that's not ...
0
votes
1answer
215 views

VBA macro to open Outlook 2016 message as “Editable”

I'd like to be able click a QAT shortcut to run a macro which opens the current Outlook message in editable mode. And inserts the text "[Edited]" so I can see it has been. I had a solution for ...
1
vote
0answers
85 views

Why does word macro behaviour change when used in conjunction with track changes?

A recent issue I noticed when running word macros (in this case specifically search and replace operations), is that they don't have the expected behaviour when track changes is activated (it makes ...
0
votes
2answers
80 views

Word VBA: Is there a way to insert a variable into a search and replace macro?

So what I would like to do is to do is for the macro to find out the number of pages in the document through: pages.count As far as I know, using the search and replace method is in this case not ...
0
votes
1answer
156 views

Deleting a footer of a section VBA macro

I am trying to find a macro expression to delete a footer of section 1 of my document. I see that this is a specific function that one can execute in Word Footer --> Remove footer, but if I want to ...
0
votes
1answer
31 views

Excel, Return a color depending on two other cells text

I need to do an analysis in Excel and I would like to color a cell depending on the text of two other cells. I have to do it for a quite big table, therefore I need a way to not do it manually for ...
0
votes
0answers
72 views

compile error syntax error macro for pivot table

Do not know VBA - cannot fix the error - please help. Bold shows the red area on macro Sub Macro3() ' ' Macro3 Macro ' ' Keyboard Shortcut: Ctrl+q ' Sheets.Add ActiveWorkbook.PivotCaches....
0
votes
0answers
32 views

Check if Outlook Calendar Date and Time are Available Based off Userform

Im trying to create a macro for an excel userform that checks if date and time are available in outlook based off of the date and time on my useform. I am currently creating Outlook Appointments from ...
0
votes
1answer
59 views

Word 2013 - macro wouldn't apply cell padding values

Just a little bit of trouble here, I was trying to create just a simple macro to remove cell padding from all tables from a document, but for some unknown reason macro doesn't apply the settings. ...
3
votes
2answers
119 views

Modifying existing code to highlight multiple different words at once instead of highlighting a single string

I have the following code that prompts for a string and then highlights all instances of it in the selected cells. How can I modify it to prompt for and highlight multiple different words in one ...
0
votes
2answers
103 views

Excel 2007 Cut and paste formula or value without changing cell formatting - paste options greyed out

I just need to cut cell contents leaving the source cell format unchanged, and paste matching destination cell formatting... I think not an uncommon ask? I have searched but Google search filter ...
0
votes
1answer
131 views

My VBA code to Save as a PDF wont work. Can someone read it and see what I might be doing wrong?

Sub SaveAsPDF() Dim NewFN As Variant NewFN = "C:\Users\Brock\Desktop\MPI\Financials\" & Range("b10").Value & ".pdf" Dim ActiveWorksheet As Variant ActiveWorksheet = "sheet1" ...
0
votes
1answer
52 views

Excel: Multiple if statements to populate cells between two criteria

I understand how to populate one of these cells using an =(if(and)), but I cannot figure out how to populate a desired range of cells between the start time and deadline time. For example, for task ...
3
votes
1answer
50 views

Excel VBA needed so what do I Google to find my answer?

I'm pretty much a master of solving my own problems in Excel, largely in thanks to people like you all. Our company is migrating to new vacation rental software and I've run into something I've never ...
0
votes
0answers
55 views

Vba: search in different sheets if values match

I am working on a project where i have a sheet for every apartment containing a lot of values what i am interested in is the surface, a sheet containing the short term reservations, a sheet for the ...
4
votes
3answers
226 views

Calling a Sheet Sub from a Userform

I'm trying to build a macro that will read the dates from cells in my Worksheet and check them against a date (month and year) inputted into a Userform. To do this, I have the Userform call a Sub ...
2
votes
2answers
476 views

Compress all images in Excel workbook

I have a workbook with over 150 worksheets. Each sheet contains an image that was copied to each work sheet from another 150 sheet workbook. The process was done by manually copying image 1 from ...
3
votes
3answers
84 views

Consolidating data from columns to rows

I have a spreadsheet: Company 1 | ID1 Company 1 | ID2 Company 1 | ID3 Company 2 | ID4 Company 2 | ID5 Company 2 | ID6 Company 3 | ID7 Company 3 | ID8 Company 3 | ID9 I need to combine each company ...
0
votes
1answer
229 views

MS Word Table Format Through VBA/Macros: Issue with Merge Cells specifically

Imagine a table of 7 columns and tons of rows. Some of those tons of rows are Merged containing Notes always containing the string "Note" at the beginning of the cell. In the whole first column ...