VBA (Visual Basic for Applications) is the dominant programming language for Microsoft Office Applications [Word, Excel, Access...].

learn more… | top users | synonyms

-1
votes
0answers
4 views

Search cell contains text and replace with letter in Excel

I need a Excel macro that would replace cell with a represented letter. For example, in the cell originally I have the following text: 9x10 Deck, 3x6 Beam and 12" Pole and I need to remove it and ...
2
votes
1answer
14 views

How to require excel 2010 workbook to be in specific filepath in order to open with VBA?

I would like to require a workbook to be located in a specific file path to open. I am using VBA in excel 2010. (Project / ThisWorkbook code: Header: Workbook / Open) Private Sub Workbook_Open ...
0
votes
2answers
22 views

Selecting a whole column as a range rather than a named range

What I have: I have drop-down list in my form that I'm populating from a worksheet. My code only works for named ranges. What I need: I need to populate my drop-down list from a whole column ...
0
votes
1answer
8 views

Name a New Sheet Based on Existing Sheet Names

I have worksheets named "Chart 1", "Chart 2", "Chart 3" and "Custom Chart". I want to make a copy of "Custom Chart" and name it "Custom 1". I want to do this indefinitely such that successive copies ...
0
votes
1answer
15 views

Macro Fails, 'The macro may not be available in this…'

Hello and thank you in advance for your assistance. I have some code that I admittedly borrowed from a site. It changes the sheet that is being displayed every X seconds. In my case 3 seconds. ...
0
votes
3answers
10 views

VBA iactivate worksheet userform

Trying to learn VBA in Excel context. I'd like to populate a listbox from a range in column A, on Sheet2 (some text strings in the column) as in the following code Public Sub Test() Dim NumTags As ...
-4
votes
0answers
20 views

insert the path in front of the file name [duplicate]

I have a column with file names such as: test1.pdf test2.pdf I want to insert path like *C:\documents* in front of each file name so that I get output like C:\documents\test1.pdf ...
0
votes
1answer
15 views

Inserting 4 Rows

I am trying to insert one row when the cell is column 4 doesn't have the same value. For some reason it is inserting 4 rows. It only happens at the start. What could be wrong? Thanks for your help! ...
0
votes
0answers
13 views

WrapText,vertical alignment and filling borders of a range of merged cells in VBA?

After I remove the links from the selected range I want to return the cells to their original style/format. I am trying to do this by wrapping the text if needed,adding a border and aligning the text ...
2
votes
1answer
27 views

Use a method on multiple sheets simultaneously without using ActiveSheet or Select

EDIT: I realize my problem is more general in nature, so I edited the title accordingly. The problem I'm having is fairly simple to describe. It has been drilled into my head (through lots of ...
0
votes
0answers
16 views

Excel VBA - Changing shape values on a locked worksheet

Evening All, I'm faffing around trying to use Excel Shapes to mimic an ActiveX TextBox control, so the text will change depending on the Range selected. I want to keep the worksheet protected so the ...
0
votes
0answers
24 views

Getting the value of a number cell with VBA in Excel

So I have section columns which look like this: 8.01 8.02 8.03 8.04 8.05 8.06 8.07 8.08 8.09 8.10 And so on and so forth. I have it set up so that it will always show the trailing zeroes (8.10 and ...
-2
votes
0answers
23 views

Count semi-matching columns

This is what I have on my excel. There are three columns Letters, Numbers, CountOfNumbers. Letters has 9 rows of HT. "Numbers" has 5 rows of HT1 and has 4 rows of HT2. CountOfNumbers has 5 and 4 ...
0
votes
0answers
30 views

VBA Excel if value not found then add something to worksheet

i have a small program that works as a cash register. the user enters an ID number into a user form that populates the user info from the spreadsheet. everything works, but i want to add ...
0
votes
0answers
33 views

VBA clear all cells in range without a background color

Original Question: I have a large spreadsheet where I need to remove the contents of all cells that are not highlighted (have a background color). *Problem Solved: the cells were actually white and ...
1
vote
1answer
25 views

Avoid loop while working with excel to notepad

I use the below code to copy some range from excel to notepad.But its very slow when i work more than 1 lakh (100,000) data . Is there any shorter way to achieve this without using send keys method. ...
1
vote
2answers
21 views

How to call a Macro when a named range (cell) is changed

I am trying to call a macro named "RE_environmental" when the cell named "RE_1" is changed (i.e. they mark a X in the cell). I've tried several different variations of codes including these two and ...
0
votes
1answer
31 views

Associating a vb Object to a specific worksheet

I'm working with VB in Excel (Office 2010). I have a class called Problem and a vb code that generates random problems and for each problem creates a new worksheet and prints the parameters of the ...
0
votes
1answer
29 views

Identifying different dynamic array VBA Excel

Here is my problem: I would like to have a dynamic array where the user have the possibility to add new parameter in an Excel Array (typically by adding new row using a buttom). I have then to stock ...
0
votes
1answer
41 views

microsoft excel vba copying data from webpage

through vba - I need to go to the page , then select option "Hawb/direct awb no." in Track by drop down, enter a cell copied from excel into "Number" field and then click "submit" button. how can i ...
0
votes
1answer
13 views

unable to load data into different tabs in Excel 2013 using VB6

In my organization we have one old project/application which was build on Visual Basic 6.0 In that application we have export to Excel "button" where data gets populated into different tabs in ...
0
votes
0answers
30 views

Improving efficiency of loops

I am working on reshaping some data and need some help improving the efficiency of my program. The goal is to copy cells from the source sheet to one of two other sheets. Which sheet a cell gets ...
0
votes
2answers
15 views

Copying visible/filtered rows efficiently in excel

I am working with some very large datasets (various sheets with 65K+ rows and many columns each). I am trying to write some code to copy filtered data from one sheet to a new empty sheet as fast as ...
0
votes
1answer
14 views

Change the active selection of website by VBA

I am trying to change the limit of products showing in the page from '15' to 'all' by VBA code through Excel module. <fieldset class="results-per-page"> <span> <label>Results ...
1
vote
1answer
25 views

error when trying to execute a macro in one workbook from another workbook

I have a multitude of reports I refresh and publish each day, and I'm trying to write a macro in a separate spreadsheet that will open each of these reports, and run the 'Refresh' macro in each ...
0
votes
0answers
21 views

Plotting multiple named arrays as single series

I am trying to create a radial grid on a dynamic plot for viewing polar data. I can create this using six circles and 12 equally spaced radial lines that extend from the inner circle to the outermost ...
0
votes
1answer
10 views

Create chart title from sheetname

I am hoping to amend my charts using VBA I have created a Named Range using formula, named it SheetNames =REPLACE(GET.WORKBOOK(1),1,FIND("]",GET.WORKBOOK(1)),"") Then in VBA, I was trying to ...
0
votes
0answers
19 views

How to change the width of data validation drop down list in excel

I have data validation in some cell say A1, 1st Problem: Some times the drop down list width becomes very wide with no reason how to fix the list width here 2st Problem: In some other drop down ...
0
votes
1answer
28 views

Excel macro help for stock updatess

I have a macro which retrieve data from the website. In the first column of excel I have product code, after hitting the process button macro opens the website and search the product codes on to the ...
1
vote
1answer
16 views

Varient data type changes value 0 to empty or blank

I am passing value 0 in the below code Dim searchtext As Varient Public Sub xyz_page_load() searchtext = 0 If searchtext = "" Or searchtext = Empty Then Debug.Print "Error" 'this line should ...
2
votes
2answers
42 views

Easily switch between single and double precision

To switch between single and double precision in C we use something like: #ifdef USE_DOUBLE typedef double data_t; #else typedef float data_t; #endif Is there an easy way to perform the same thing ...
2
votes
0answers
35 views

Object oriented style - where to define properties? VBA

I'm quite green on object oriented programming and trying to get my style right. Very often I have an object of which one the properties is a dictionary containing other objects. Call it class ...
0
votes
0answers
13 views

When I saved my excel file xlsm and reopened it, the macro was reported to be correct [migrated]

I've been learning vba recently and a disturbing question came up to me. I simply tried the message box code: MsgBox("hello world"), and then saved the excel file with .xlsm extension. When I reopened ...
0
votes
0answers
9 views

is it possible to make comment appear faster in excel? [migrated]

there are some comments in my Excel sheet is it possible to make them appear faster when user hovers a mouse pointer? Currently user has to wait around 1 second.. i couldn't find such option in GUI, ...
0
votes
1answer
24 views

Comparing character strings in separate cells in Excel spreadsheets?

I have a large Excel spreadsheet with alpha-numeric data. I want to be able to compare two cells in different row side by side and return the difference in another cell. e.g. I have in cell B2, ...
1
vote
1answer
26 views

How to disable save and protected sheet prompt in excel using VBA

I have an excel sheet which is protected, since the sheet is protected I don't want the user to save it, and I don't want the save the sheet prompt to appear when someone closes the workbook. Till now ...
-1
votes
1answer
16 views

'Method Range of object _Global failed'

I've seen a few posts on this problem. I know what's causing it but I'm trying to figure a way to stop it from appearing. What it is there is one excel file called Main which I have to keep open and ...
-2
votes
0answers
32 views

I need help writing an excel macro in visual basic [on hold]

I'm trying to write an excel macro that does a simple calculation using values in existing cells and outputs a value. I basically want to write a formula that takes column a and column b and does the ...
3
votes
1answer
26 views

Type mismatch error in VBA when using mmult

I am trying to code this forumla in vba. =MMULT(TRANSPOSE(F124:F370-L124),G124:G370-L125)/246 The code in vba I written looks like this: Sheets("1.A").Cells(124, 14) = ...
0
votes
0answers
21 views

Pulling Out Values from Dynamic Variables

I have a problem I am stuck with for a few days in Excel macro. I have 12 Excel cells (which can have any no from 1 to 12 - unique numbers only) I have 12 string values stored in 12 variables Arr1, ...
-2
votes
0answers
34 views

Macro Issue ( Help writing Macro)

Hi I have a macro which thanks to this site has been created to make a summary page with a list on it. Please find below Macro as it is currently: Sub SummurizeSheets() Dim ws As Worksheet, ...
1
vote
1answer
22 views

Use of Average gives Application-defined or object defined error in VBA

I am trying to find the average of the few cells using VBA, but when I run it, it gives me error. This is the code I have written: Sheets("1.A").Cells(124, 12) = ...
-2
votes
3answers
32 views

Find and replace VBA [on hold]

I'm trying to write macro/vba to find text "send Payment to" in a column and replace the text below it with new text. For example, in column B, Sent Payment is in Cell B2, B11, and B55. Below each of ...
1
vote
1answer
41 views

Why does workbook turns hidden after vba executes

Here is the sub Sub test() With ThisWorkbook .Worksheets("Sheet1").Range("A1").Value = 5 .Save End With End Sub Here is the vbscript that starts the sub dim eApp set eApp = ...
-1
votes
0answers
21 views

use excel VBA to automate crystal report export PDF file [on hold]

I am looking for a code that I can use in excel's VBA to automate opening a bunch of individual crystal report files and exporting them individually into PDF files. Can anyone help me on this?
1
vote
1answer
30 views

VBA - Import list of folders into excel range

I am currently working on a macro that imports files from a number of subfolders within a folder named "simulations" which is in the current working directory. The code I have is working for ...
0
votes
0answers
31 views

Sending a pre-selected item on dropdown list VBA

I designed a macro to enter a website and fill in my e-mail and my password. Till here, no problems... But I need to change the pre-selected item in a drop down list and submit it directly. The big ...
0
votes
0answers
23 views

Excel VBA 1004 error, wont write to cells in another workbook

I am trying to coy over data entries from a summary sheet to a form in a different work book The interpreter gives me a 1004 Error "Application Defined Error" when ran on the specific line ...
0
votes
0answers
18 views

Write excel 2007 table to specific location in a word document using python 2.7.5

How can I alter my script(s) so that I put an excel table in my word document at a specified location if certain conditions are met? (I may actually add several tables if certain conditions are met, ...
0
votes
2answers
27 views

How to have vba execute every 10 minutes?

I need to have my macro executed every 10 minutes . This allows it to work in 10 minutes sub my_Procedure () msgbox "hello world" end sub sub test() Application.OnTime Now + ...