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
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
163 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, ...
3
votes
1answer
62 views

Change color of Cells based on another cell´s value

In this vba: Sub color() Dim color As Integer For Each cell In Sheets(6).Range("F2:F65536") If IsEmpty(cell) Then GoTo nextcell: If Not IsNumeric(cell.Value) Then GoTo nextcell: If cell.Value > 50 ...
2
votes
0answers
69 views

VBA prompt for Copy and paste from combo box in active cell

Could anyone help me to copy and paste from combo box in active cell and below mentioned code created to copy and paste from drop down in active cell but i need a code to copy paste in any cell where ...
1
vote
1answer
62 views

why am I getting compile error when trying to copy data from master sheet to multiple worksheets

I am very new to VBA and macros so I apologise if this is simple. I have found similar posts but nothing that I am able to adjust to my problem. I found code to create a new worksheet for every new ...
0
votes
1answer
102 views

Powerpoint VBA combine pptx files into one

I have seen a post like this before but could not add more comments and could not implement the solution. So please do not criticize :) I basically need to open an empty pptx file and give a location ...
0
votes
1answer
97 views

vba error 1004 method intersect of object _global failed

UPDATE (question reworded) I have 2 different Private Sub (in ThisWorkbook). Each is working fine "alone". However, when they are both activated, I get the vba error 1004 method intersect of object ...
-2
votes
1answer
125 views

Auto-create sheets and populate data from the master sheet

I have a sheet named sample with the below data. LOCATION EMP_ID INDIA 1234 INDIA 2345 INDIA 3456 USA 4567 USA 5678 I need to create sheets automatically ...
1
vote
2answers
84 views

How to optimize a VBA function in Excel

I wrote a function in VBA and have provided a simplified version below. Basically, it takes an argument, preforms a vlookup on a named range in the sheet using the value of the argument, passes the ...
0
votes
0answers
58 views

Windows 7 and Outlook 2016 - Force meeting reminders to focus

I'm following up on an existing question (rep won't let me comment or answer) How to make Outlook Calendar reminders stay on top in Windows 7 I've messed around with the VBA code from the answer and ...
0
votes
0answers
42 views

my code works fine as a macro yet fails when i run it in a button

So far, one line is failing as i try to pick apart the macro that works fine as a macro but fails when i copy the code to a command button click... Sheets(c.Value).Range("a1:i330").Copy Destination:=...
0
votes
1answer
50 views

Word Index not in 100% alphabetical order

Windows 7, Word 2010 & 2016 I have a macro that searches my document for some text, and when found, add that text to an index. The idea is that I have many definitions (format: [word] - means [...
2
votes
1answer
73 views

Loop until end of document

I need to select every third line of a document and format the text to bold, underlined, and blue. I already have the code for this, but I need to loop it for a set number of times. The problem is,...
0
votes
0answers
43 views

Use Excel's Publishobjects.add to write to an FTP site

I am trying to publish some Excel (named) ranges as html files to my website. I can only reach my website through FTP. I am using the ActiveWorkbook.PublishObjects.Add method to do it. With ...
1
vote
1answer
35 views

VBA intersect range should only work in sheets having the defined target range but bypass that request

In order to reinitialize a child drop down (drop down 2 depending of the choice made in drop down 1), I have the below code in "ThisWorkbook". It is supposed to clear the content of the child drop ...
0
votes
1answer
29 views

EXCEL VBA get source folder to Const

i have a code "copyMultFiles" Move many value in many file to single file My Problem is cannot use parameter in "Const" Error this Line " Const csMyPath As String = vaFiles1 " vaFiles1 is get source ...
-1
votes
1answer
58 views

Excel 2013: Time/Date Stamp upon change in cell value

I am using Excel 2013 on a PC running Windows 7. In Excel, if cell A1 changes from one value to another, I would like a date time stamp to appear in cell B1. Assume cell A1 could be blank or filled ...
0
votes
1answer
119 views

Set printer Excel vba macro

Im trying to print through a macro to a shared printer on a colleagues PC. I have tried the following but to no avail Sub Tag() ActiveCell.Resize(1, 1).Copy Worksheets("Sheet1").Range("A1") ...
0
votes
0answers
25 views

Modify properties of tables in batch

I am working on a MS word document which contains several tables, and I want to modify the properties of all of them at once, such as alignment, text wrapping, borders and shading etc., and either for ...
0
votes
1answer
124 views

Insert picture in header with VBA from picture located in workbook

Was using this but it became quickly apparent today that expecting the picture to be in the same directory all the time is not a good plan. With ActiveSheet.PageSetup.LeftHeaderPicture .filename ...
0
votes
0answers
25 views

Have excel functions auto-update when a parent function changes

I have several columns of data of differing lengths, adjacent to each cell in each column I want to perform the same formula for the relevant adjacent cell. The formula is identical for each case, ...
0
votes
1answer
18 views

Control Names Causing my Macro to Crash

I have a series of macros in a form that I have created for my field people to use. When they have completed the document and want to send it on to the appropriate folks, I have created a FINISH ...
0
votes
1answer
52 views

how to add a background color to my IF statement

if have the following IF statement: =IF(R1=R3,"GreenBG","RedBG") how can i add a background color using the IF statement (is it even possible)?
0
votes
1answer
23 views

How to wrap my macro in a IF EXIST clause [duplicate]

I have the following code: If Sheets("EstimateTemplate").Visible Then Sheets("EstimateTemplate").Select ActiveWindow.SelectedSheets.Visible = False Sheets("Navigation").Select Else ...
0
votes
0answers
82 views

Split data into multiple worksheets with formulas & formatting

I have a macro that splits data across multiple worksheets. It almost works as I would like; it pastes values onto the split sheets, but I need it to paste formulas also. How can I amend my code to ...
0
votes
0answers
65 views

Wrap text and shrink to fit excel VBA

I'm trying to copy text from one sheet to another with VBA. Sub Tag() ActiveCell.Resize(1, 1).Copy Worksheets("Sheet1").Range("A1") ActiveCell.Offset(, 1).Resize(1, 1).Copy Worksheets("Sheet1")....
0
votes
1answer
98 views

click on a cell change the value of another cell

I can not achieve to do what looks like an easy process... I would like to give a value ("Hello") to a cell (named "ClInfo") in sheet named "Hardware" by a click on a cell (C47) in sheet named "1". I ...
2
votes
2answers
37 views

Labeling a shape in Excel 2007 VBA

I've created a macro to make shapes using AddShape.  I name it with .name but I can't put a label on the shape icon with the macro. If you manually click on a shape you can enter a formula to place a ...
-1
votes
1answer
78 views

Merge Data From Multiple Columns - Sharepoint Survery Results

I am using SharePoint to collect data through its survey feature. However, I want to make the output data more manageable. As such, I want to take the multiple columns and consolidate them into a few. ...
2
votes
1answer
31 views

Column Data filter

I have a column of data that I'd like to 'filter', this filter has two distinct components. Step 1: Move down through a column of data Identify gaps in blocks of data Gaps less than a nominated ...
3
votes
3answers
266 views

Insert a formula into the same cell on each worksheet using loop

Using the loop function of VBA, I'm wanting to input the same formula into the same cell on each worksheet in my workbook. I've tried the following code, but it doesn't loop through all worksheets. ...
0
votes
2answers
22 views

Filling in column based on column values

I have a set of values in a column as follows: 1 1 3 3 12 12 43 43 94 94 88 88 The spacing is arbitrary but there are always two of each value. What I'd like to do is fill in the blanks ...
1
vote
2answers
80 views

How to convert a table into summary as shown

I have table as below. I want to add rows for a category and sum all (excluding null) same species (say lemon), same species length under each category . Now i want to consolidate the table as shown- ...
1
vote
2answers
34 views

Excel duplicate row consolidation

Could someone please help me out with this one I have no idea how to go about it. Here is the data set I want to combine the data from each colour from each method into 1 row. In this example ...
1
vote
0answers
76 views

Pivot table with dynamic field names in Excel 2010

I am creating a workbook where the user can paste in their dataset in a worksheet. This dynamic range will be used to generate a series of pivot tables on subsequent worksheets. This works well when ...
0
votes
1answer
26 views

Filter on specific subject but only unique / first instance

I have an Outlook rule that is triggered by any incoming emails with the word "crisis" in the subject. The problem is that it is triggered by any corresponding replies in our ticketing system (...
0
votes
0answers
108 views

Import from TXT file but skip specific lines via VBA

I need to import from a TXT file into an XLSM file but skip specific lines. I have a text file that is being imported into an excel file but if the TXT file has more than 117 lines I need it to skip ...
0
votes
1answer
45 views

Unhiding a row using a macro based on cell value (for 10000 rows)

I am very new to macro. However, I found a macro on this website to hide rows with the value of False. I edited the macro to also make it unhide the row again, and it worked fine. The problem is that ...
1
vote
1answer
146 views

Summing unstructured 'blocks' of numbers in Excel

I have a column of data in the following general format: 2000 1000 500 300 1500 c a 1000 1500 1250 3000 4000 6500 3000 1000 1000 1000 f 4500 1500 3000 3000 2000 There is no pattern to the ...
1
vote
1answer
52 views

Access report loses elements when exported to Word

I have created a Microsoft Access Report, with a number of elements in it. These include labels, controls, lines, boxes, etc. When I export the report to Word, it loses all lines, borders, boxes, ...
3
votes
1answer
92 views

Remove multiple 'ThisWorkbook' modules from Excel VBA editor

Within the VBA editor, I have found duplicate instances of the 'ThisWorkbook' module seen in this screenshot: I would like to delete these extra instances, but do not know how. ThisWorkbook1 is ...
0
votes
1answer
64 views

VBA equivalent for “Refresh this connection of Refresh All”

Excel enables by default the "Refresh this connection of Refresh All" setting for its connections. Can I programmatically turn it off and on for connections? I basically need something real instead ...
-2
votes
1answer
47 views

How do I run a VBA function in Excel? [duplicate]

I want to run this function I opened the developer tab in excel, no clue what to do now. I tried creating a "macro button", and then paste the function code in the macro script, but if I press play I ...
1
vote
1answer
17 views

Input “minutes:seconds” format in cell, have Excel convert to seconds and report in same cell

I'm trying to have Excel convert "mm:ss" input into "ss" format in the same cell. For example I want the user to enter "1:21" (not time of day, but mm:ss) in Cell A1 and have Excel convert it to ...
0
votes
1answer
34 views

word VBA macro sorting

I have a structured text: hello, hellos <xxxyyy>; nice, nicer <uuuvvv>; great, greater <wwwzzz>; and would like to write the three text pieces between < > under each other: ...
0
votes
0answers
48 views

How to make ALL labels show 'Series Name' on chart?

Here is my stacked bar chart. I would like to make all labels on it show the 'Series name'. I don't want to individually select all of the data labels and change them More info It is possible to ...
1
vote
0answers
34 views

Section of VBA code is stuck in a loop

From what I can see this code should work but it ends up stuck in a loop so obviously there is still an issue. The intention is to start at cell E70 and paste a value obtained from cell X38. Move ...
0
votes
0answers
55 views

Macro that can import data from a worksheet to another worksheet but placed on specific columns

Can someone kindly assist me in creating a macro that can manipulate data as needed? source file: [2 columns] [05:51:59] SANJEEV: Hello [05:52:03] Dennis: Hello, Sanjeev. [05:52:05] SANJEEV: HI ...
1
vote
1answer
113 views

How do I export all images from Excel and give a name from a related cell

I've got an excel-sheet with about 200 rows. There are 200 images and 200 names. I have to extract every image and give the related name. The structure is like this: Image -> A2 Name -> B3 ...
0
votes
1answer
192 views

Very slow execution of Excel 2016 VBA codes

I'm having a case of slow vba code execution. I find it hard to believe because I have a quad-core Core i7 processor operating at 2.6 GHz. In my workbook, I have an input form on a separate sheet to ...