VBA stands for Visual Basic for Applications, a subset of Visual Basic used in all Microsoft Office Applications. Consider tagging your question with the application as well as [VBA]

learn more… | top users | synonyms

0
votes
1answer
2k views

Excel vba code for adding a value to existing cell of sheet

i have this code to add value of a cell to existing value of other cell which is below Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Not (Intersect(Target, Range("E3")) Is Nothing) ...
0
votes
1answer
14 views

Error outputting a string to cell

I am using a vba macro to automate part of an excel spreadsheet. The following line keeps giving me a runtime error 1004# application or object defined error Sheets("Material").Last.Offset(0, ...
0
votes
1answer
13 views

Deleting rows that contain a keyword in the column

I have an excel file that has a id as one of the columns, each id has multiple entries and follow a set of survey questions. I need to delete all of the rows that have that keyword (which is in a ...
0
votes
2answers
24 views

VBA Excel: How to assign .txt file content to a string type variable?

I made a little sub in excel that sends an email according to the parameters you enter: Sub Mail_LSP(mailsubject As String, consignee As String, coalcopy As String, mailbody As String) Dim mlook As ...
0
votes
0answers
14 views

How can a Macro sort dates from oldest to newest?

I'm doing account statements in a bank and I need to be able to make them fast, so I am using macros for making this process. However, there is a step that I always have to do that a macro won't let ...
1
vote
0answers
10 views

Why doesn´t my Outlook rule work more then once?

I´ve recently migrated my email to an exchangeserver, with my previous email set as a forward to my current one. I´m using outlook 2010 and Samsung galaxy s5. First problem at hand: Some E-mails ...
0
votes
2answers
40 views

Adding together values from multiple spreadsheets (VBA)

In my Excel workbook, I have three separate spreadsheets. The spreadsheets are identical in format and represent count values for different categories (passenger cars, trucks, etc.). I need to combine ...
2
votes
1answer
2k views

Macros in Excel 2010 hangs

I have a spreadsheet with several macros. Generally, when previously using Excel 2007, a user clicks a button and everything works as expected (calculations, some email sending & file I/O). ...
0
votes
3answers
9k views

Excel VBA Macro Sub or Function not defined

I used the macro recorder to generate a macro in Excel 2007. When I try to the run the macro, it tells me: When I click Ok the definition of the macro gets highlighted. I'm really confused ...
0
votes
0answers
13 views

Replace multiple words in Excel sheet

Sub xLator2() Dim s1 As Worksheet, s2 As Worksheet Dim N As Long, i As Long Dim from(), too() Set s1 = Sheets("Sheet1") ' contains the data Set s2 = Sheets("Sheet2") ' contains the translation ...
1
vote
1answer
42 views

Find and replace multiple words in a column in Excel 2007

Sub xLator2() Dim s1 As Worksheet, s2 As Worksheet Dim N As Long, i As Long Dim from(), too() Set s1 = Sheets("Sheet1") ' contains the data Set s2 = Sheets("Sheet2") ' contains the translation ...
-2
votes
0answers
17 views

VBA Code to Connect Database and execute a stored procedure through a click of button in excel 2013 [closed]

I am new to VBA. Can anyone please help me to write VBA code that should connect to a SQL server database and execute a stored procedure through a click of button in Excel 2013. Details below: ...
0
votes
1answer
24 views

Excel: portable formula to reference data on previous (relative) worksheet

I need to create a fairly simple Excel spreadsheet (workbook). I need 12 sheets (tabs), one for each month. Each sheet references cells in the previous sheet. For example, the "May" sheet is ...
3
votes
1answer
1k views

VBA to save document in Excel and Word periodically (AutoBackup)

I want to create a VBA script that would save a copy of the document every 5-10 minutes with a new name. The script would keep like 10-15 copies in the same folder, incrementing a number each time. If ...
2
votes
1answer
34 views

Replace cell references with values without F9 using macro

This is an Excel macro question. Given a series of formulas such as the following: = A1 + A2 = B2 + B2 etc., ... I would like to replace each of these cell references with the values without ...
0
votes
1answer
36 views

Hide columns based on content (sum of rows)

I'm trying to hide columns based on the sum of selected rows (i.e., cells) in those columns. For example - if the sum of E9:E12 is 0, then hide column E. Additionally, and probably a little harder - ...
0
votes
1answer
44 views

Expanding a cell formula resolving all its references (precedents)

In Excel I have a cell containing a formula referencing other cells, which reference other cells and so on... forming a large tree of references. I'd like to substitute recursively all the occurrences ...
0
votes
1answer
9 views

RE: displaying max of direct data input or cell value from formula

With reference to : Excel - how to either have direct data input or cell value from formula I would like to inquire on a related issue. How would i edit my VBA formula if i would like to compare the ...
0
votes
1answer
18 views

Disable or delete right click menus VBA

Whenever I right click on an excel sheet two menus come up: one with cut, copy, paste, etc. and one with font size, bold, italic etc. I can customize the first one to have whatever command I want. ...
0
votes
0answers
12 views

Creating an Excel Search Box which Unhides a Row

I've never done VBA before and I'm pretty sure that's the only way to achieve what I need. I have a master password list which I don't want people to see when they are looking at my computer. ...
0
votes
1answer
9 views

Filtering out (blank) within a PivotFiled from all pivottables in a workbook that have the same pivotfields

I have a bunch (14) of pivottables in two worksheets (7 in each worksheet). I have a refresh button on the sheet that refreshes all pivottables using the following code: Sub Refresh_Pivots() Dim pt ...
0
votes
0answers
33 views

Forfiles SubFolders

I am hoping I can get some help here. I saw a another post similar to my problem and I figured I would give it a try. I have a Forefiles code running in Excel using VBA. The code works great on local ...
2
votes
0answers
36 views

copy data from multiple word files to excel with vba

I know this question was already asked (Copying data from multiple word docs into one excel sheet) the thing is I can't use the answer. I'm fresh to vba, but I thought I can handle it. I was wrong. I ...
0
votes
0answers
24 views

VBA Code to update data in closed excel files within a folder by clicking a button

I have a code which works really well that updates values of closed excel files in a workbook. What I want to do is alter the code so I can create a on my worksheet where I can make y changes I ...
0
votes
1answer
2k views

Excel 2010: dynamic update of drop down list based upon datasource validation worksheet changes

I have one worksheet for setting up the data sources of multiple data validation lists. in other words, I'm using this worksheet to provide drop down lists to multiple other worksheets. I need to ...
-1
votes
0answers
16 views

Excel or R: Make 1 file for each line of a table, preserving the headers

I have 200 lines in an excel table that I'd like to split into 200 files (csv), with the headers maintained in each file. Is there a way I can do this using VBA in excel, or even R? Many thanks
0
votes
0answers
4 views

How to paste clipboard text into AlternativeText of an image - Winword 2010

Using VBA, in Winword 2010; how can you paste the text contained in the Clipboard into the AlternativeText of the current selected image within a word document? Below is the code I've done, to ...
1
vote
0answers
11 views

Convert HTML to Word and embed file hyperlinks as attachments.

I have some HTML files that I'm opening with Word and saving as docx files. I have some macros I run to break the links on the graphics so that they get embedded in the doc file, but I haven't figured ...
0
votes
1answer
19 views

Excel 2007 VBA Export range as jpg file is trucating picture

I have a workbook with many different ranges of data with 77 lines or more. I need to copy them and save as JPG files, which will be used by other application. Below is the example of code that I'm ...
5
votes
1answer
2k views

How to auto advance a PowerPoint slide after an exit animation is over?

PowerPoint entrance animation set up with "Start: With Previous" starts right when a new slide is advanced. However, if you set up an exit animation in the same way, it doesn't start with a slide ...
-1
votes
0answers
15 views

Add-in Not working [closed]

I got this code from google and am trying to make it into an add-in. It currently wont work as any time I run it on another xlsm file I get the message. Cannot run the macro "MyGreatMacro". The Macro ...
3
votes
0answers
43 views

show more than 8 items in the Data Validation drop down list in Excel

I have added a simple data validation to a cell but it only displays 8 items in the dropdown. Excluding the combobox solution and probably involving some WinAPI is there a way to make the drop ...
-1
votes
1answer
107 views

Data appears different after opening .xls file through a macro

I have extracted a file from a SAP system and saved it as spreadsheet with extension .xls. I have another excel file which contains a macro to open the former: Workbooks.Open Filename:= _ ...
0
votes
1answer
2k views

How to Open specific file in specific folder with macro excel

How to Open specific file in specific folder with macro excel. Example I put Path in cell A1 "D:\My Data", and I put sub directory in A2 "Kitchen" and last I put file name in A3 "Rack.xls" Thanks ...
0
votes
1answer
40 views

VBA Lookup by Multiple Criteria - Then Copy & Paste

Currently I have a 2 way database with 10+ fields and 1,000+ rows. Some fields are customer name, car model, year of model, price, date of purchase. I would like to lookup rows of data by multiple ...
4
votes
9answers
26k views

Copy Excel worksheet and maintain relative cell reference in formulas

Another copy problem in Excel: How can I copy a Worksheet from WorkbookA.xlsx into WorkbookB.xlsx without the copied Worksheet still referencing WorkbookA.xlsx e.g. the formula =B!23 becomes ...
0
votes
0answers
97 views

Microsoft Office 2010 - Programs crash at direct opening

I have been having this problem the past few days. I am working on a project I plan on getting working through VBA in Excel 2010, and that has resulted in an Excel file containing numerous Macros. ...
2
votes
1answer
3k views

Outlook 2010 - using a VBA script in a rule

I was following the directions in a great post when I got to the step for selecting the name of the script to run. I have VB code in ThisOutlookSession, but for some reason, the name of the procedure ...
0
votes
2answers
4k views

How to change the text color by a function in Excel 2010

How does one achieve the following: If (the value of cell A1) < (than the value 0) then (all the text representing the number in cell A1) should be the color (RED)?
0
votes
3answers
2k views

Outlook: apply rules to current message?

KMail has a really useful feature: you can define a series of rules which are only run when you press a keyboard shortcut, and then only on the highlighted messages. This allows me to read a message ...
1
vote
1answer
595 views

Excel Macro pattern matching filter

Can anyone help me write this as a VB/excel macro. I would like to select the following from one data sheet and write to another data sheet. Select any rows where in column T the field contains the ...
0
votes
0answers
25 views

VBA Excel: Macro working well, add-in does half of the job

I created a macro that: 1.takes the value in cell "D11" then 2.trims the value acording to some criteria, then 3.opens another workbook ans searches the trimmed value then 4.copies some info to ...
1
vote
2answers
31 views

Excel 2010: Calculate full months between dates

I have dates in two columns and I would need to calculate amount of full months between two dates. I export the spreadsheet from SAP ERP in .xls format but opening with Excel 2010. DATEDIF function ...
1
vote
0answers
33 views

Transferring Data Between Workbooks Based on a Value in a Specific Cell

I have created a form in Excel that moves information entered in the form to the adjacent sheet in the same workbook as well as my agents workbook at a different file path. That piece of the puzzle is ...
0
votes
1answer
394 views

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

Note: Originally I asked how to select text from a certain point downward, but I've got a solution for that: Dim f As Word.Field For Each f In ActiveDocument.Fields If f.Type = wdFieldAddin And ...
0
votes
1answer
43 views

Months and Date keep being switched around when running VBA

I have a column on my sheet, Column F which is full of dates. Now I need these dates to be in this format "dd,mm,yyyy" but sometimes they are in text form, us/armenian format in the original data. Why ...
0
votes
0answers
16 views

Displaying images from database in a pivot table

I've got a table with sales data on MySql server. I can connect to it from Excel and generate a pivot table just fine. One of the fields in the table contains URL to an image of a product. Is there a ...
0
votes
1answer
43 views

Obtaining Frequency of A Number for Each Sub-Heading

I have two columns, one with people and times associated with those people, and one filled with 0s and 1s. For any given person there is some associated combination of 0s and 1s. We can determine ...
0
votes
1answer
3k views

Split Excel worksheet into multiple worksheets based on a column with VBA

Question is simple and may be repetitive. I have an Excel workbook which contains around 50 columns I have a criteria column for splitting this workbook into mulitple workbooks The approach is as ...
0
votes
0answers
32 views

Automation of solver in Excel by VBA macro code

I'm solving a 3rd degree polynomial equation, e.g., -0.003x3 +0.195x2 -1.087x -180 = 0 in Excel. I can do this by SOLVER of Excel and can find the value of x. The problem is the constant term ...