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.

0
votes
2answers
239 views

Unlocking Edit Ranges In Excel Using VBA

I am using VBA to add information to my spreadsheet whenever data is entered into a different column. However, to do this, I unlock and lock the sheet as part of the vba script. This requires the ...
1
vote
1answer
64 views

Combine multiple worksheets into one sheet while excluding some worksheets

I have 5 people that each maintain their own Excel file. The files all have a tab that I care about with the same data structure (columns) and more 20,000 rows each. I need to pull that tab from each ...
2
votes
1answer
162 views

Change excel formula language using VBA

I need to be able to use english formula on my french laptop. Is it possible to use this without installing a language pack? I have seen this answer from Microsoft: https://answers.microsoft.com/en-...
0
votes
1answer
101 views

Save and rename an attachment from outlook 2013 to a specific folder

I have been using the steps from another post on this site and it worked for a few days and now it does not. The file always comes in from the same person and is always an xlsm attachment. I enabled ...
0
votes
1answer
39 views

How to set auto sort on two columns when open the workbook?

I have a workbook that we run for weekly reports, however daily we are adding new records also. Now, I want to know that how could I set auto sorting on two specific columns every time I open the ...
0
votes
0answers
61 views

Excel VBA Get the content of a string variable (my_name) from a cell with an address in other cells

in a macro I want a variable (My_name) to get a value (string). This value is in a cell of which the row index is in cell A1 and the column index in A2. Probably very easy for somebody with a little ...
1
vote
1answer
24 views

Can I code parameters directly into this macro or do I have to add them in each cell?

I'm using this macro to identify cells that contain non-alphanumeric characters: Function RegExCheck(objCell As Range, strPattern As String) Dim RegEx As Object Set RegEx = CreateObject("...
0
votes
1answer
315 views

Excel pivot values column to Text

I have data in Excel pivot and my text data in value column shows number instead of Text . Any one can help me please. In below image of pivot value field red circled:
0
votes
1answer
216 views

VBA for copy paste from file and sheet name as given in excel cell

I am using following VBA Code to copy data from a closed excel sheet. the name of sheet changes as per the date. so I assign the path and file name from the excel cell B1. Now I am stuck at one place ...
1
vote
1answer
54 views

Make rows mandatory if first cell is filled in

I have an Excel file where I want people to fill in specific stuff. I want to make a range of cells in a row mandatory if the first cell in the row is filled in. E.g. if cell A7 is filled in, cells B7-...
-4
votes
1answer
41 views

Macro is not working in 2016 Excel

Private Sub ListBox1_Click() Application.ScreenUpdating = False Dim Filepath As String Filepath = Worksheets("Postavke").Range("B1").Value & "\" & ListBox1.Value ...
0
votes
1answer
112 views

VBA run time error 1004 when I protect the sheet

I have a shared workbook with two sheets, one sheet has many formulas, so I want to protect the "sheet 1". I also cut and pasted some VBA code into the "sheet 1". The VBA works great until I ...
0
votes
1answer
69 views

Excel VBA - Recover user form deleted by mistake

By mistake I have deleted my userform in Excel VBA. How to restore the user form? Could anyone help me in resolving my issue? It's almost a week's work.
0
votes
2answers
45 views

Syntax error in Microsoft Excel macro for converting into PDF

Sub invoicepdf() Sheet2.Range("a1:j53").ExportAsFixedFormat xlTypePdf,Filename:="C:\Invoice data\" & Sheet2.Range("j12").Value, OpenAfterPublish:=true End Sub I'm using this in Excel vb for ...
0
votes
1answer
245 views

How do dynamically hide cells/sheets without macros

I recently created a company excel workbook that used to have an a lot of rarely used columns/cells and was tasked with making it simpler but still universal. I was able to create a checkbox with ...
0
votes
1answer
38 views

Could someone please help why this line of code is giving me an Object defined error

activeCell.FormulaR1C1 = "=SUM(" & activeCell.Offset(0, -2).Address & "+" & activeCell.Offset(0, -4).Address & "+" & activeCell.Offset(0, -6).Address & "+" & activeCell....
2
votes
1answer
45 views

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

I am having a problem with how tab selection behaves in an Excel sheet on merged cells changing when it is protected versus when it is unprotected. I have a merged cell that is two rows high. When ...
1
vote
1answer
136 views

word macro to highlight sets of words in different colors

I have a Word macro that I customized a while back from someone else's (unfortunately I can't find the source). The purpose is to highlight all occurrences of "he" and "his" in turquoise, and all the ...
1
vote
2answers
87 views

Filtering Excel Data by Column Value and Saving Columns to Individual Files

Many years back we had to come up with a solution to survey results that we were getting via CSV. Back then we'd get data where the first column was e-mails, and subsequent columns were 1's or null ...
1
vote
0answers
111 views

Can the name of a range be dynamic with multiple sheets in Microsoft Excel

I am a newbie on VBA. What I would like to know is can the name of a range be dynamic with multiple sheets. I have searched online and came across a similar question asked by someone else and was ...
0
votes
3answers
171 views

Creating a macro to segmentally average the data in a given column [closed]

I would like to create a macro that averages the values of every 12 items in one column in an Excel worksheet, for example, A1-A12 then A13-A24 etc., and places the results in cells C12, C24 and so on....
0
votes
1answer
452 views

Runtime Error 91- Excel VBA

I'm new to VBA and having an issue with the below code, each time any cell (other than one in Column G) is selected the following error appears; "Runtime error 91 - Object varible or with block ...
0
votes
2answers
326 views

VBA Code for filtering a column using Input Box

Im looking to filter a column based on a code the user puts into an input box. I used the following code: Sub Filter() ' ' Filter Macro Dim strName As String strName = InputBox(“What DMA would you ...
-1
votes
1answer
116 views

Find, copy, move selection using Word VBA

I've tried this every which way and it still goes past the End bookmark. Sub Macro3() Dim rngStart As Range, rngEnd As Range Set rngStart = ActiveDocument.Bookmarks("START").Range Set ...
0
votes
1answer
30 views

Changing VBA code to affect workbook instead of sheet

I have found this code on how to change chart design in a whole sheet, and i would like to change it to affect the whole workbook instead of just my active sheet. Sub ChangeCharts() Dim myChart ...
0
votes
0answers
275 views

How to split multiple worksheets of data by column value and output to separate files?

I have an Excel 2010 workbook (let's call it 'Master') with two worksheets, Sheet1 and Sheet2. Each worksheet has data structured as shown below. One of the columns (in this example, Column1_header)...
1
vote
1answer
365 views

Exporting Access query to Excel using VBA and creating a secondary axis chart

In MS Access I have a database. I have Form with three TextBoxes and one Command Button. In txttask_plot user writes Plotid In txttask_from user selects date1 In txttask_to user selects date2 The ...
2
votes
1answer
226 views

How do I select text between two “bookmarks” in Word VBA?

I used the code you provided for this previous question but I am getting the Compile Error: Sub or Function not defined. I'm using VBA 7.1 and Word 2016. Sub SelectTextBetweenBookmarks() Set ...
2
votes
2answers
44 views

Finding specific seconds in a cell with time

I have a column of times in hh:mm:ss format. I need to identify each cell in the column that ends in :01 (XX:XX:01). With Excel's time function, a =right(cell, 3) search doesn't find them. Any ...
0
votes
1answer
29 views

VBA: how to highlight when contains a text

I am getting the following error Run time error '13': Type mismatch with the code below. Please help. Sub test() ' With Range("A1:C10") ' .Value = ""true"" ' End With If ...
0
votes
0answers
221 views

Excel vba, Changing cell references in formula to point to different cell location

I am trying to move (offset) only parts of formula column location to a different column location by a specified amount of columns. The formula cells change from sheet to sheet. I have thousands of ...
-1
votes
1answer
58 views

How to sync same excel workbook between 2 computers on the same network

I need some help with this please. I have an input workbook where product data is entered, and an output workbook(Report) where this said data is copied into a single line using vba macros. The ...
0
votes
2answers
65 views

Advanced Forms in Word

I am looking to create a form in Word where the value selected in a combo box will determine the text in another section of the form. First, if I create a Combo Box in a Word document, how do I ...
1
vote
1answer
130 views

Excel VBA - Use string variable as input to Union Method

Somewhere in the Sheet called Sheet 2 I have the following: Click for image It uses the TEXTJOIN function to concatenate the values in Column A. The string in B100 is variable S (see the code). I'm ...
0
votes
0answers
36 views

Make Excel Spreadsheet Fill Page when Printed

I am attempting to print a spreadsheet that automatically fills the page utilizing all space available. The amount of rows varies, but the columns do not. The reason is that people hand write in the ...
0
votes
0answers
11 views

How to add checkbox to excel automatically?

Suppose I have three columns; Column A, Column B and column C. How to add checkbox using VBA automatically in column A if I put text in Column B (only) not Column C, and when I delete that text, ...
1
vote
3answers
236 views

Can Excel VBA call Macro in Different Macro Workbook

Can VBA code in an excel spreadsheet call a different XLSM Workbook file's Macro? I have a local XLSM that needs to call a method in a different XLSM file, how can that be done?
0
votes
0answers
52 views

Set Custom Path While Exporting in VBA

I am using this post's accepted answer for one my exports. Based on the answer, it saves my exported .csv file in my C:\Users\username\AppData\Roaming\Microsoft\Excel\XLSTART. However, I need this ...
0
votes
2answers
178 views

Auto Hide/Unhide all rows based on value in colum

I have "sheet2" in which data populates dependent upon what's entered into "sheet1". The data populated is either "N/A" or a particular statement. In sheet2 I'd like any rows with "N/A" in Column G ...
1
vote
1answer
62 views

Conditional defalt on data validation list

EDIT No. 2 *Ok, my previous articulations of my problem were, as pointed out, pretty rubbish. This edit, rephrases the question in a more straightforward manner, summarises the context and provides ...
-2
votes
1answer
47 views

Moving data from one sheet to another via a hyperlink

I've searched the existing questions and found similar questions and answers but none that meet my requirements. I have a spreadsheet where I wish to be able to click on links in one spreadsheet to ...
0
votes
2answers
33 views

Excel offset from two different workbook, create a copy of one without affecting the other

I am using two different workbooks the first one [Excel Data only] created as a databse and the second one [Invoice Template] created to create an invoice. When creating an invoice i am using offset ...
0
votes
1answer
33 views

Can't open VB editor in EXCEL 2016

I used to be able to open the VB editor in EXCEL, but suddenly I can't. I was in compatibility mode but have reset to normal mode. Other Workbook now have the same problem.
0
votes
1answer
327 views

How can I modify the “Applies To” property of a Cell's Conditional Formatting rule using VBA?

I'm attempting to use VBA to create a conditional formatting rule and apply it to multiple cells. I've attempted this is by creating the rules for one cell only and then editing the appliesto ...
1
vote
1answer
82 views

Defining a range within a filtered column in Excel

I am attempting to make a macro that I can use to automatically select all values within the filtered range of the column. Ideally I am trying to get this to work with 10 filter conditions (1-10), but ...
0
votes
0answers
17 views

when I save each invoice I get all the blank lines in the invoice showing up as well

I am creating a database for a friend of mine. on 2 sheets then I have an invoice list that calls data from the inventory list based on an item code ( using Vloolup). I then have a VBA formula which ...
0
votes
1answer
107 views

VBA CleanFileName and CleanUsedRange

I am having some issue with the following code. Whenever I run the vba code, the CleanFileName and CleanUsedRange code delete my Vlook formulas. Is there any way to use the CleanFileName and ...
0
votes
0answers
37 views

How to rank two values based on the following criteria

I have the following two columns, Benefit and Cost scoring results, each of which are out of a hundred. I want to be able to order each row based on its ranking compared to each of the other row ...
0
votes
0answers
19 views

On Excel right click on Sheet tabs is disabled

For the past few days I am not able to right click on sheet-tabs in Excel and select move or copy. The right click menu is not coming up. It looks like it could be a VBA issue as MS support person did ...
0
votes
1answer
67 views

Display Show List when Value selected in Cell

]I would like a dashboard worksheet that has a text box listing the string value of a particular cell in each worksheet in a workbook, but only if that cell matches a specific value. Scenario: I have ...