Questions tagged [excel-vba]

THIS TAG IS PENDING REMOVAL. Instead, please use tags [excel] and [vba]. (More info: https://meta.stackoverflow.com/q/370095) Excel-VBA (Visual Basic for Applications for Microsoft Excel) is the dominant programming language for Microsoft Office Excel. It is an event-driven and object-oriented programming language for writing macros for Microsoft Office applications like Excel. DO NOT USE THIS TAG for VB.NET questions.

Filter by
Sorted by
Tagged with
0
votes
0answers
9 views

Interacting with IE drop downs with VBA. (Send Keys not working) (getElementbytag not working)

I have tried 10-20 variations of the code below: If dropDown <> "" Then Dim post As Object Application.Wait Now + #12:00:04 AM# Set post = ie.document.getElementById("swapUser") Application....
-1
votes
0answers
8 views

Create a minimum application in Qt to convert VBA code to dll (calling VB compiler)

Create a minimum application in Qt to convert VBA code to dll (calling VB compiler). excel vba code to dll and use in excel? is there anyone who can provide solutions for how to make excel vba code ...
0
votes
1answer
25 views

On Excel i require to change the cell formulas to values only when a certain date passes

I have a pivot table on excel that automatically updates with values every day. I have columns next to the pivot table for EACH DAY that grabs data from the updated pivot table using a simple formula,...
0
votes
0answers
11 views

How do I replace numbers in the front and back of a string using vbscript?

I was wondering if someone could help me out with a problem I am having. I have tried and tried and just cannot get the one thing down. Here is the code I came up with so far. ''' If InStr(Value , "I-...
0
votes
1answer
73 views

How can I make For loops with an If statement more efficient when iterating over rows in VBa?

I have a For loop nested inside another For loop which iterates over every row in a spreadsheet. The nested for loop below checks the current row and then loops over every row in the spreadsheet to ...
0
votes
1answer
239 views

Open a Workbook with Path and Filename Stored in String Variables?

Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Dim strPath As String Dim strName As String strPath = Environ("USERPROFILE") & "\Desktop\REQUIRED FILES\ART REPORT" Set objFSO = ...
0
votes
1answer
60 views

How to consolidate data from multiple excel workbook into master workbook and eliminate duplicate append?

I'm stuck in a problem in VBA while consolidating data from other workbook to master work book and using file name and path name is variable which is changing dynamically in loop i searched but i only ...
1
vote
2answers
4k views

Parsing JSON data into Excel sheet

I'm trying to extract JSON data into Excel sheet as table by using the following code. Sub test() Dim httpObject As Object Set httpObject = CreateObject("MSXML2.XMLHTTP") sURL = "https://...
-2
votes
1answer
56 views

Adding an OR statement within a boolean

The following code gives me 4 different boolean options. 'Yes b1 = CBool(ds.Cells(x, 1) = ds.Range("E1") And _ ds.Cells(x, 40) >= fs.Range("C2") And _ ds.Cells(x, 41) >= fs....
0
votes
1answer
47 views

Is VBA able to store each array individually and wait to print them to a template?

Is there a way to have this script form the entire array based off the rows I want it to extract based on the IF Statement? I know this finds a name on the Mgrs worksheet, and finds those rows in ...
0
votes
1answer
394 views

Delete a UserForm and add a New UserForm in Excel VBA

What I would like to do is Delete a Userform and replace it with an updated Userform using VBA for Excel. I exported the original Userform, made my changes, and now would like to replace the original ...
0
votes
1answer
137 views

How to dynamically select a specific cell in excel VBA using loop?

Below is my code Sub Append() 'Append data from other files Path = "E:\NPM PahseIII\" Filename = Dir(Path & "*.xlsx") If InStr(Filename, ".") > 0 Then Filenamenoext = ...
0
votes
1answer
39 views

Opening an EXE Application after a timeout with VBA

This is a bit tricky to explain, but let me try. I have 6 UserForm in a VBA Project. The execution of the macro will hide each form and show the next one in line. In the first UserForm, on the ...
3
votes
2answers
1k views

Disable SAP logon popup in Excel VBA

I have a VBA code which helps to login into SAP. The code works fine but I am getting a warning popup when it establishes the connection. I need to either bypass or disable this warning popup. I have ...
1
vote
2answers
47 views

IF statement to trigger specific conditional formatting?

I have an IF statement that triggers if assessment results have been placed in columns B & C. Some of the info will be filled out, but sometimes there will be some blank cells. I have ...
1
vote
1answer
59 views

How to run a macro from another workbook?

I have a subroutine that opens a workbook containing a macro. I then want to run that macro. My code looks like this: Source = "C:\Users\208896\Desktop\Moje Makra\newidea-inbound-query.xlsm" ...
0
votes
1answer
77 views

Print array in VBA using MsgBox function

I don't usually use VBA but am just trying to double check some values against something, so I would really appreciate some help. I am trying to create and print an array using the MsgBox function. ...
0
votes
2answers
708 views

Excel VBA Use of INDIRECT in data validation

I'm having an issue with application of the Excel INDIRECT function in data validation when applied by VBA. I am using VBA to populate the data validation criteria, and using INDIRECT to find the ...
1
vote
2answers
660 views

VBA to delete without warning any sheet for which the name contains the word “sheet”

I have a small piece of VBA code here which Deletes the worksheet called “Sheet1” Without Warning. What I would like that my code do is to delete without warning any worksheet containing in its name ...
0
votes
1answer
28 views

“Operation Search and Merge”: VBA

I've been trying to scavange together a macro which will merge several .CSV files. However, the data I need in said file (GPS data) is located in different rows of column A. I therefor need it to ...
0
votes
1answer
47 views

Excel VBA filter one column and count values in other

I have a database where is in column C the names of tools like: KDX15, GUA10, PKN01 and they are repeated in this column many times but they have added value each time in column D. Example: C | ...
0
votes
1answer
177 views

ActiveCell. does not target the active Cell in Excel VBA

I created (partly copied) a macro that, depending on the selection in the first sheet, adds a row in the first and the second sheet in the same place. Yesterday morning it all still worked fine, but ...
0
votes
1answer
1k views

VBA to select multiple values from a slicer

I have a pivot table with a slicer. The slicer has 50+ values in it and these values can change. I use the slicer to filter the data - I am always looking for the same 5 values, and my 5 values start ...
0
votes
1answer
64 views

VBA Error 1004 while trying to paste formulas in cell

I'm pretty new to VBA and I've been trying to use a macro to paste a few formulas in cells. Problem is, everytime I do so, I get a 1004 error on the very first formula. I strongly suspect it's ...
1
vote
3answers
134 views

How can I shuffle a 2D array in VBA?

I have the follow script to put a list of people with there know skills in an array and then match the first match with a customer with the same skill. Every time it runs the results are the same. I ...
3
votes
2answers
55 views

SUM of VLOOKUP functions meeting criteria in Excel

Sorry for the macabre subject matter, but I need to add the ages up of a group of people IF they have died. My data is structured as follows: Sheet A has the list of people to analyze. Sheet B is an ...
0
votes
1answer
252 views

Filter, Copy and Paste Loop with Non Constant Column Location in VBA

I'm looking for some help with putting together some code in VBA that will filter a column with a certain header name, copy and paste that information into a second sheet, and then perform the same ...
0
votes
4answers
69 views

How to write a loop that has multiple criteria?

I am trying to replace values in a column based on certain criteria. Here is my code: For i = .Rows.Count To 1 Step -1 If .Item(i) = "w" Or "x" Or "y" Or "z" Then .Item(i) = "...
1
vote
1answer
42 views

Accessing two different workbooks from personal macro

I have a personal macro which accesses two different workbooks. Here is the updated code: Sub Copy_and_Paste() Dim ws1 As Worksheet Set ws1 = Workbooks("Submittals").Worksheets("Sheet1") ...
0
votes
0answers
53 views

VBA Copy to range specified by variable reference

I need to copy a range to different part of the sheet that can differ in a column used. I recently introduced the variable copy_col to the code that tries to make the destination area flexible and I ...
1
vote
3answers
366 views

How to get meta property from a URL using VBA?

I am trying to get the price of product from URL and it has <meta property="product:price:amount" content="47.2" /> I tried the following to get it but it does not work Set price = ie....
1
vote
1answer
131 views

Export Excel Chart To Word Using PasteFormat is Returning Error 4605 Command Not Available

So I'm trying to understand what is wrong with my code. All I'm doing is taking some charts in my Excel workbook and exporting them to a Word document but I keep getting an error if I try to paste ...
-1
votes
1answer
36 views

Retrieve same set cell values across multiple tabs from new spreadsheets and formatting

Need to copy and paste set cells data from multiple business entity spreadsheets and match format of master spreadsheet. Need to copy and paste set cells within each tab on workbook and populate a ...
0
votes
0answers
204 views

EXCEL check memory used for each calculation

I have a excel that contains about 20 sheets. I have hundreds of calculations among those sheets. Is it possible for me to figure out a way to find how many memory is being used for each calculation? ...
0
votes
0answers
41 views

Is this an error in VBA's round function? If so does anyone know when/why it occurs?

I used this code to print some round outputs. Private Sub TestRound() Dim i As Double Dim vTest As Double vTest = 17.005 For i = 1 To 10 Debug.Print vTest, Round(vTest, 2) ...
0
votes
1answer
57 views

why am I getting a Runtime Error 438 message on LastRow?

A newbie with vba and trying to workout where the error is but can't figure it out. I am getting a Runtime Error 438 Object doesn't support this property or method on the "LastRow" line and not ...
-3
votes
1answer
65 views

Reference a cell in excel to the content of an external text file

I want to Reference a cell in excel to the content of an external text file. I have this file c:\calc.text which just have a number inside. I want to put number inside the calc.txt inside a cell of ...
0
votes
0answers
187 views

ActiveX Command Button Stops working when Excel is closed and then reopen

I am not the most experienced with vba so forgive me... I am currently working on some code that automates and captures data from an Omicron Program. This involves one activex commandbutton that once ...
0
votes
0answers
86 views

VBA: Yes/NO Message Box - Automatically press No If there is no response for 5 seconds [duplicate]

I'm looking to automate a workflow of opening a Workbook, running a macro and closing a file //Run a Macro// ActiveWorkbook.Close But the problem with this is that I can't edit anything if I want to ...
0
votes
2answers
47 views

Check availability of folder/files

Sub CWSSCheck() If ActiveSheet.Name = "Position_by_Fixture" Then Call FileCheck ElseIf ActiveSheet.Name = "Group_PositionList" Then MsgBox "This is the Group Position List. Convert the Shelfstock ...
0
votes
1answer
188 views

HTML - onmouseover, onmouseout - Element click error- Object variable or with block not set Error 91

I have a website where I got Menu bar which is in frame 1 and its sub menus are in frame 2. Now I have found all the element where I need to go. But problem that I am facing is that if I manually ...
0
votes
1answer
36 views

VBA double Loop sheets and cells

please see below code. It works well but when I am trying to add extra loop over all sheets it gives me an mismatch error 13 This one works Sub ostdat() Dim val As String val = InputBox(Insert) For ...
0
votes
2answers
140 views

Trigger same macro with different command button with Button properties

as the subject suggest, I have build a macro that will need a variable input Sub GetFile(Account as String) Currently i am setting multiple sub to call the script and assign them to different ...
0
votes
0answers
169 views

How to call enter key inside the SAP

I create a macro to extract a file from SAP and i try to record step by step before copying the script from visual basic in Excel the code is working fine but in the last row of code the script is ...
0
votes
3answers
136 views

Multidimensional Array redim

once again I need some help :) I have a List of values And for each line it should check if there is another row where the values of column D and E are identical to the current row. So all values ...
0
votes
0answers
46 views

Import multi EXCEL files with relationship between them( Vlookup ) into MS SQL Server

I have multiple Excel files that have relation between them. I want to use their data and develop a Web Application. First of all I need to import them into SQL server.( I think SQL Server is more ...
1
vote
2answers
100 views

Excel VBA help to automatically run macro at 4 points in the day

I am trying to run a macro 4 times in a day. 10:10 am, 12:25 pm, 15:25 PM and 18:15 PM. This excel file is opened in the morning and is open all day. The following day the file is resaved under a ...
0
votes
2answers
141 views

VBA How to programatically use conditional formatting and have it apply to numbers only.

Using VBA and Excel I have a dynamic range and I want to apply basic conditional formatting that turns the box green if there is a number greater than 0.8 some cells have text and not numbers and I ...
0
votes
0answers
62 views

How to edit the data in cells with different rows and columns respectively with userforms

Here is an example of how the data is placed: Here is an example of how my userform is structured: Client Userform The codes for the update button are as follows which does not work: Private Sub ...
0
votes
1answer
215 views

How do I navigate to another page by double-clicking on an HTML table row?

I am only able to highlight the row but I am not able to double click in the TR in order to fire the event and to go to the next page. Here is my VBA code: Set table = webpage.Document....