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.

learn more… | top users | synonyms

0
votes
2answers
12 views

Looping through two column to check for condition

I want to loop through column P and see if there is a cell that has the number "1" in it then at the same time loop through column N to see if there is also a number "1" at same row/column, if there ...
0
votes
1answer
70 views

Check excel cell if font is a certain color?

I want to use vba to check if the text in a cell in excel is of a certain color, lets say red. Any ideas?
0
votes
0answers
29 views

Excel, worksheet scrollbar size

I have a problem with the vertical scrollbar on one of my worksheets. The worksheet contains ~20000 rows and the scrollbar is too big to use conveniently. However when I click and drag it, it ...
0
votes
2answers
55 views

Excel VBA incrementing columns

I am trying to combine multiple columns of varying lengths into 1 column on another sheet to allow for vlookups off this column. I am able to increment down through the first column easily, but I am ...
0
votes
0answers
21 views

In MS Access VBA Designer window all menus, ribbons and tootlbars are missing

The missing items make it impossible to use. Code can be written, but not executed and tested.I have tried many solutions, most of which are to restart the VBE, but that does not work. In fact, none ...
0
votes
2answers
30 views

VBA query - adapting existing code

I've found a bit of VBA which is helping me do what I want to do, which includes the following: With ThisWorkbook.Sheets(TargetSh) NxtEmptyRw = .Cells(65536, 1).End(xlUp).Row + 1 .Cells(NxtEmptyRw, ...
0
votes
1answer
28 views

#NAME? on UDF that previously worked

I created a VBA function: Function LOJA(x As String) Dim a As Integer Dim f As String Dim f2 As String Dim f3 As String a = InStr(1, x, "-") f = Right(x, Len(x) - a) a = InStr(1, f, "-") f2 = Right(f,...
0
votes
1answer
47 views

Change name box of a image inserted into excel worksheet

When you insert a picture into a excel worksheet, you get automatically Picture 1, Picture 2, and so forth...... I have a function when a picture is selected to put black border around it. Problem is, ...
0
votes
0answers
36 views

Excel 2007 Unprotect Sheet prompt in password protected sheets on Windows 7 machines

Windows 7 users of software I created in Excel get an "Unprotect Sheet" prompt when clicking on any sheet or cell in a sheet that is password protected. They hit cancel, sometimes several times and ...
1
vote
1answer
56 views

MSWORD VBA close document on save

I am trying to get a document to close when saved, using VBA. I have searched for this extensively but mostly it comes up with people trying to not turn off saving when closing a document. What I ...
0
votes
1answer
104 views

Excel trying to save as PDF using a Cell Value for both the Path and the File Name

I've been using excel to save my Worksheet as both PDF and as a .XLS separately based on a cell value, but it saves in the same folder as the parent file. I have been trying to find a way to use VBA ...
0
votes
2answers
55 views

VBA: how to hide rows if a cell contains a certain text

I am using Excel 2013. I am new to VBA. I found a code that would simply hide 2 rows (36 and 37) if my cell N39 is equal to "Passed" I found that code but I receive the message "ambiguous name ...
0
votes
1answer
36 views

Excel macro: replace entire worksheet with different values [closed]

Is it possible to replace entire worksheet with different values at the click of a button through macro? There are no "replace X with Y" or any recognizable pattern, I'm trying to replace ALL values ...
0
votes
0answers
22 views

How to hide sheets that have cell u1=x

If I want to hide tabs that have u1=x, how would I do that? I have this but it is just hiding all pages instead of just the ones that have u1=x Sub Hide_Sheets_Containing() Dim wks As Worksheet ...
0
votes
0answers
62 views

Match between two cells if values is in a range VBA

I'm struggling in VBA because I want to compare two cells in order to check if there is a partial match between them. But I want to remove the entities that are not common to both cells through list ...
0
votes
0answers
74 views

Opening Google Chrome with macro instead of IE

I have a question regarding a VB macro that opens automatically a file in IE 11. The problem is I cannot get the download prompting to disappear (believe me, I've tried everything from Tools in IE, to ...
-1
votes
1answer
45 views

How to clear print area

I am new to macros. I am trying to find a macro that will clear the print area on specified worksheets that do not have cell u1="x". My workbook has over 80 worksheets.
0
votes
2answers
21 views

How can i change the directory in this VBA code? VBA “Excel to TXT or CSV”

I really want to change the directory of this code in Application.ActiveWorkbook.Path but i don't know where to put it. Public Sub CharacterSV() Const DELIMITER As String = "|" Dim myRecord ...
1
vote
3answers
53 views

Find first string in text string that is numbers only. Formulas only

Is it possible to find the first string within a string that contains only numbers/digits? I have a few thousand addresses to process and some of them have Apartment numbers. I need to find the ...
0
votes
1answer
25 views

Underline Definitions in Index? (or keep formatting from orig. text)

I'm building an index in a word document that is going to be definitions. My index will look like: Superhero - someone who is a super being.....17 Bus - an automobile that is long, like a ...
2
votes
1answer
111 views

Excel Macro to create 8 character username

I'm trying to use an Excel VBA macro to create an eight character username and what I came up with fails. If entered in a cell, the formulas seem to work. In my spreadsheet, I have the last name in ...
1
vote
0answers
24 views

How to make text baseline and midline visible in Word?

I want to make baseline and midline (or x-height line to be precise) visible (and printable) in a line of text (presuming characters in the line are the same font and size). Is it possible to do so ...
0
votes
1answer
42 views

Hightlight cells where the IFERROR=TRUE; Not “TRUE”. Suggestions?

Example: Formula: IFERROR(H12,1) Table: I am trying to highlight every cell in the table that returns a 1 only if the IFERROR statement is TRUE (not "TRUE"), and without comparing the returned ...
0
votes
1answer
32 views

Record multiple calculation results at each change of single input cell

I have a spreadsheet that calculates reduced generation and emissions per fuel source for the state of Wisconsin at different levels of solar photovoltaic capacity in the state, as a percent of the ...
1
vote
2answers
38 views

“The object invoked has disconnected from its clients.”

I have a button that prompts for input and creates a new tab. The first run it works great, but subsequent runs throw this error: Here is the code: Sub btnAddProject() Dim template As ...
0
votes
0answers
29 views

Automatically (VBA) remove page colour when replying or forwarding email

I am looking to create a macro to remove the page colour from an email when replying to it or forwarding it, either automatically on the single click of a button, instead of having to go to the ...
1
vote
1answer
34 views

Assigning a variable based on a formula in VBA Excel

I'm trying to do a simple a macro that runs a formula and displays it in a msgbox. Right now I have: Sub basic_messagebox() Dim CAT1 As Integer MsgBox "The total number of possible Cat I: " &...
4
votes
2answers
38 views

Finding multiple local maxima and placing data labels on corresponding chart

Spectrum that I am using complete with 10,000 data points I am a chemistry student of sorts and I frequently have instances where I need to find multiple peak heights (as seen in the attached ...
1
vote
1answer
32 views

How can I enable my worksheets in Excel to auto-update the filters I have applied to them

I have looked on the other threads to no avail for this. I have a few sheets in my workbook, with one being a data sheet and the others pulling data from it. I have set a filter in these sheets to not ...
0
votes
1answer
77 views

MS Word VBA - Converting All Plain Text Links to Hyperlinks

I have a rather large Word file (+1,100 pages) that contains plain text links of media coverage. For instance, the Word document contains: The News Leader (AP) Va. police officer who died on her ...
1
vote
1answer
44 views

How to mirror a column that has merged cells?

I'm working on a "consolidated grid" spreadsheet. It has sheets for each project and then a main grid that lists statuses from each sheet. Everything works great unless the project sheet happens to ...
0
votes
2answers
40 views

Excel VBA Run-time error 9 subscrit out of range

While closing the workbook I am getting: Run-time error 9 subscript out of range This is the VBA code: Set wbk = Workbooks.Open(path & filename) wbk.Sheets(sheetname).Range("b6").Resize(...
0
votes
0answers
44 views

How can I change the screen resolution from a VBA script?

I'm writing code in Excel VBA to load a userform that fills the screen. The form is large enough that I cannot see the buttons and lower part of the userform. Is it possible, and how, to change the ...
0
votes
1answer
41 views

Format a column of phone numbers in multiple ways in Excel 2016

Okay, here's my situation. I have an excel spreadsheet with a list of badly formatted phone numbers from my company's CRM. Most of these are domestic, USA numbers with a +1 country code, some are ...
0
votes
0answers
46 views

How to display text RTL in Excel

I've got a bunch of spreadsheets with Hebrew names in them. About half have the names typed in proper RTL order, the other half have the Hebrew characters typed backwards in LTR order. All cells are ...
1
vote
2answers
80 views

VBA - Copy a row and insert into row under it

Prefacing by saying I don't have any VBA experience, but I need this data sorted fairly quickly. I have a Sage 300 Invoice Import I need to do. I can sort this data via formulas after it's made a ...
0
votes
1answer
48 views

Losing characters when copying and pasting into a batch file via VBA

I am currently using the following VBA code to copy and paste a range of data in an excel file to create a Batch file. I am running into the following problems: Quotations are being placed around ...
0
votes
0answers
12 views

In Microsoft Word, scroll to bookmark in new window

I searched superuser and Google before posting, but didn't find anything on the subject. For the next couple of weeks, I will be working on a Word (2013, on Windows) document in which every paragraph ...
-1
votes
2answers
44 views

Macro (on button) to modify row where the cursor is

I want to be able to have a button on an Excel sheet, place cursor on any row/column on the sheet, click on button and the entire row defined by cursor row/column will modify (color fill and maybe ...
0
votes
0answers
23 views

How can I protect excel macros - Office 2013 on OS X

I've Googled how to protect macros in Excel. I keep getting directed to go to "project properties" under "tools" in the VBA editor. However I can't actually find this option. I'm guessing its because ...
-3
votes
1answer
37 views

Microsoft Excel - Interactive Average [closed]

Its for an assignment. There are data given for january to June , and July data is empty. After I enter July data average is created. Task is I have to fix a program, that after I put data in july a ...
0
votes
1answer
27 views

How to stop Excel from creating “phantom” zeroes when copy/pasting

I'm running Excel for Mac, 2011 and dealing with a fairly large data set (~500 rows, 75 columns) and a lot of the data was entered with the incorrect signs (+/-) for entire columns. There are also a ...
0
votes
0answers
11 views

Use file with new name?

I am trying to figure out how to use a file in excel with a new name. Every time I generate the specific file Windows creates a new file name for that file. However, there are specific unchanging ...
1
vote
1answer
56 views

Knapsack / Sum-Total Variation. In EXCEL, how to get all combinations of numbers that where the sums fall within a certain range?

Hi I am new here and was hoping one of you could help me. Note, this topic is similar to some out there, but none have answered this exact question. It is exactly the same as this unanswered ...
0
votes
1answer
58 views

How to create multiple sendkeys macro linear order of operations

Range ("D5").Select ActiveCell.Resize(1, 25).Select SendKeys ("%y1"), True 'Alt+Y1 SendKeys ("%y2"), True 'Alt+Y2, Activates third part add-in SendKeys ("~"), True 'Enter, initiates the merge add-in ...
0
votes
0answers
13 views

Using Excel 2010 I want to be able to hid and unhide columns based on if there is text in a particular cell in another sheet

I want to have a list of names in column B of sheet 1 of people within a group. Then in sheet 2 I want it to pull through the people's names across the top row of a new table (row 5). If there is no ...
0
votes
0answers
13 views

MS Word 2003 and later

I have hundreds of very useful macros organized on various button bars. I name my macros in an organized way, so when I create a project button bar through the Organize dialogue box all I see are ...
1
vote
1answer
42 views

Excel VBA - Calculation is returning sum for Last Row instead of First Row

I'm trying to set up a calculation that sums all of the values between "M" and "X" in each row. However, when I run the code, it only gives me the sum for the last row in the worksheet, when it ...
0
votes
0answers
58 views

Getting certain cells that have 'x' in each row and getting the header row cell

I am trying to copy things from one spread sheet to another. I was wondering if there was a faster way than doing it manually. I have posted a picture of a sample I'm currently working on. Looking ...
0
votes
0answers
159 views

Excel VBA - Run-time Error 13 - Type Mismatch

I keep getting the Run-time Error 13 - Type Mismatch on the following line: MonthsWithValues = Application.WorksheetFunction.CountIfs(Worksheets("Analysis Worksheet").Range(.Cells(i, 13), .Cells(i, ...