Questions tagged [vba]

Visual Basic for Applications (VBA) is an event-driven, object-oriented programming language for writing macros, used for the entire Office suite as well as other applications. VBA is not equivalent to VB.NET, or VBS; if you're working in Visual Studio use [vb.net]. If your question is specifically ...

0
votes
0answers
9 views

Excel VBA NOW() pasted into cell not being recognised as date/time

Im having trouble with the NOW() function after it is pasted into a cell. To give you a brief description, I have built a Checkin window that records times of when people start end work via a user ...
4
votes
2answers
21 views

Concatenating Title and Name Strings in Access

I'm trying to concatenate the title, first name, and last name of a contact into one string in an Access report. Currently I am using a text field with the control set to =[ContactTitle] & ' ' &...
0
votes
1answer
11 views

PowerPoint VBA - extending chart data range

I am trying to create a VBA macro in PowerPoint that will extend the range of an excel embedded chart to the last row with data. How can this be achieved?
1
vote
3answers
26 views

Excel VBA - How to check if target is a named range. If yes, paste range

I currently have my excel coded to do the following: Whenever various specific text strings are typed anywhere in column B, a corresponding named range will be pasted at a relative offset. Instead ...
1
vote
1answer
24 views

VBA Can not insert object

I have a process in Excel that adds images from a PDF file with the following code: valRef = "TabName" FilePath = "\\network\file.pdf" ' Process stops in the next line Worksheets(valRef).OLEObjects....
1
vote
3answers
35 views

Copy unknown range from specific worksheet

I am trying to do a copy in VBA, as part of a bigger macro so it needs to be in VBA, of an unknown range in a specific worksheet. I have this code that work if I am in that worksheet: Sub Copy() ...
0
votes
2answers
22 views

Excel - hide the same columns across multiple workbooks

I need to hide the same columns across several workbooks. For example, I want to hide columns B, C, F, H, I, J, K, R, Q, AA, etc, and I need to hide those same columns in many different workbooks ...
0
votes
2answers
33 views

Ms Access Get filename with wildcards or loop

I am using MS Access Forms and I am trying to open a file but don't know how to open the file based knowing only part of the name. Example below works Private Sub Open_Email_Click() On Error GoTo ...
0
votes
0answers
27 views

VBA: How to choose files from a folder based on a precondition loop in same sub?

I am very new to VBA and I am trying to automate a dashboard process for my team. The dashboard takes two raw data files, I call these raw data and OP. I created a sheet with macro where I paste the ...
0
votes
3answers
23 views

VBA: Delete all slides (in PPT) except for specific ones

I am executing a code in through Excel and I would like it to delete all slides in my PPT except for slide 1, 2, 3 and 17. I can't seem to get it to work. Here is a snip that deletes all slides in ...
1
vote
0answers
12 views

Chart Templates Auto Load in Excel using VBA/Macro

I need help to establish vba or macro for Auto creating Charts using my saved templates. Problem is that I have in 1 Excel file more columns and second sheet. From those columns I need actually 4 ...
0
votes
1answer
12 views

FollowHyperlink without prompt or open a program with prompt vba excel

I have been trying to find a get around to open a program in excel using VBA to just automatically open instead of having the prompt come up. I am doing this so it will just open my e-mail in the ...
2
votes
2answers
32 views

Using VBA to find the exchange rate on a specific date with API Norges Bank

I would like to use VBA to retrieve foreign exchange rates on specific dates useing the API from Norges Bank. I tried to modify a code I have used before to retrive data from another API, but I'm not ...
0
votes
2answers
23 views

Excel VBA Macro Compile error: Expected End Sub

Trying to assign my code to a button which works stand-alone in VBA however but I'm receiving the following error when adding it to a button; Compile error: Expected End Sub My code is as follows; ...
0
votes
2answers
26 views

Hide a row (in a list) based on drop-down multiple selection on each of the rows (not on a single cell)

I have a list of "activities" in column B and each of them has a drop-down list for the status in column C. For each activity I can select "Done, In progress, TBD, Cancelled". What I want is to hide a ...
0
votes
1answer
25 views

Run shell command synchronously from VBA whilst showing and capturing the output

I want to run an R script from VBA for which I use the rscript.exe. I also pass this script 2 arguments. The execution should run synchronously and the output should both be displayed live and stored ...
-1
votes
1answer
23 views

Converting cells in a collumn in one worksheet as collumn headers in another worksheet

example Worksheet 1 id category 1 dog 2 cat .... worksheet 2 name , dog , cat .... However the first worksheet will grow so I cant use a paste special and when I link the cells =...
0
votes
1answer
23 views

Using Countif when searching for partial strings in cells

Looking for some help using both COUNTIF and INSTR to determine the number of separate occurrences of a string in a set of data. I have the COUNTIF statements working for the cell values, but I am now ...
0
votes
0answers
13 views

Macro to extract data from one Excel File to another if it meets certain “criteria”

I am new to the whole macro coding and creating "smart" workbooks and things like that and was wondering if you could help me with a certain macro to extract data from one file to another. The data ...
-1
votes
2answers
47 views

SQL - Convert data type varchar DD/MM/YYYY to date format in sql

I'm working on a Azure SQL database. I'm trying to convert a field data type containing dates in dd/mm/yyyy format from a varchar(100) to a date field. I am having no luck! Any help would be ...
0
votes
0answers
14 views

Excel VBA: Error When Opening .txt File for Editing [duplicate]

I have this fairly simple code to remove lines from a text file: Public Function AltText() Dim inFile As String Dim TempFile As String Dim FinalFile As String Dim data As String ...
0
votes
0answers
18 views

VBA/Excel - Setting range name to specific value

I have the following data structure: +-----------------+---------------+ | ExcelRangedName | Default Value | +-----------------+---------------+ | Name1 | | | Name2 |...
-1
votes
1answer
17 views

VBA MACRO Make Variable Range

I really struggled in making this work. I have below line of code: ThisWorkbook.Worksheets("Diags").Range("$A1:$Y50000") I am successful if I will convert the last number after $Y as below: ...
0
votes
0answers
18 views

import excel and text files together via vba

A data processing reporter is created via Excel. VBA system imports data from 3 different TEXT files (.csv, .tsv, .txt) as 3 different sheets in Excel file. I want to import a new file but from ...
2
votes
1answer
31 views

VBA keep a number to rows with timestamp

I'm new in VBA and I'm suffering to make a script to work properly. Target: I have on A10 cell a dynamic number, every few days or hours its value changing by a formula. I want to keep all the values ...
1
vote
0answers
15 views

Run VBA macro in workbook using Python xlsxwriter

I am a Python beginner so please have some patience. I wonder is there a way that I can open and run a macro Excel code in a opened workbook before I close it ? Here is a part of the code : ...
-1
votes
0answers
9 views

Excel Macro: Change an Input, Then Paste Values in a Column

I need a VBA code to change a value in a list then copy an entire column of hard-coded values and paste into 3 columns on a separate sheet. I think this is fairly simple, but I am not sure how to do ...
0
votes
0answers
15 views

Excel macro to Automatically generate the data and save file

I have a Excel macro which filters and get the data from another workbook and save as the file in a path I have mentioned. Now I need the macro to do the same for the whole list in the specific ...
0
votes
0answers
21 views

Excel VBA Message Box when there are no blank fields in an autofilter and stop macro

I have a simple macro to set one AutoFilter column(field 4) to a particular value, and a second AutoFilter column(field 5) to show only blank entries. Sometimes there are no blank entries and in this ...
0
votes
0answers
18 views

Access file saved as Netweaver workbook in Analysis for Office through VBA/VBScript

This is my very first question in here, forgive me if i'm not being accurate. I need to access a file saved on a Netweaver platform (Analysis for Office) trough VBA/VBScript. My goal is to access ...
0
votes
1answer
28 views

Excel VBA - Comparing values consisting of data from two columns, with two columns on different sheet

I've created an Excel document for Serial number based Inventory. The document consist of four sheets, Main, Storage, Incoming-history and Outgoing-history. On the main sheet I have five columns: "...
0
votes
0answers
18 views

Excel Macro- How to Paste Excel Chart in an already open PPT

I have an already opened ppt and I am trying to paste excel charts into it from the Worksheet= PivotChart. The below code is not working. This was provided to me by a senior who is not available to ...
0
votes
1answer
18 views

Excel VBA Cell referencing after autofilter

I have 3 batches of autofilters that work just fine. After the filter, i need to know how can i reference a cell (in this case the very first cell in Column D) as this particular column is common ...
0
votes
0answers
14 views

copy range between two unknown workbook names [on hold]

I'm trying to copy a range between two workbooks (the names change) in VBA but I can't make it work. Please advise Sub CFS() Dim testname As String testname = ActiveWorkbook.Name Range("...
4
votes
0answers
56 views

VBA How can I call the constructor of a return class from C#

I have a class in C# with constructor namespace CollectionHandler { public class Dict { private Scripting.Dictionary dict = new Scripting.Dictionary(); public Dict() {...
-5
votes
0answers
18 views

Is it possible to compare ExcelA Sheet1 vs ExcelB Sheet1 then ExcelA Sheet2 vs ExcelB Sheet2? [on hold]

I have two Excel workbooks, each with more than 1 sheet. Is it possible to compare ExcelA Sheet1 vs ExcelB Sheet1 then ExcelA Sheet2 vs ExcelB Sheet2 and so on using VBA?
-3
votes
0answers
22 views

VBA codes to loop multi selected cell in email [on hold]

I have a request form in excel, the user will filled up the fields. One of the field is multi selected cell and when they submit the form it will generate an email. But no value generated in email for ...
-3
votes
1answer
24 views

Excel vba, inputing a value in a specific cell based on its row and column value [on hold]

I need help, in my sheet1 i have a list of names in column A and lists of month in Row 1. I have also a userform with a combobox1 filled with all the names in column A and combobox 2 filled with ...
0
votes
2answers
21 views

Fetching data from xmlhttp.responseText into excel

I am writing a macro to fetch some data from website. I got struck in the following step. I want to take data part and print it in excel. I provided below the data structure and code I used to print ...
0
votes
3answers
30 views

Excel VBA seemingly simple problem: Trim, Copy (insert), Concat on selected range

rank Newb here. So, here's the problem. I have a simple, 1 dimensional collumn of cells containing text. I would like to do the following: strip ".jpg" extension from string duplicate each line ...
0
votes
0answers
11 views

Sending Outlook Appointment from VBA, getting weird formatting error on iOS Notes

I've written some VBA in Excel that allows a weekly staff schedule to be emailed out as an Outlook appointment. The invitation contains relevant project information such as the Project Managers ...
0
votes
1answer
23 views

Extract html source code into excel using VBA

I am trying to simply paste the content or innertext into excel using getElementByID function. The content is actually the iframe link which I am trying to extract it and paste into cell. The photo ...
0
votes
1answer
29 views

Method or data member not found.

when debug it will shows - method or data member not found and will highlight at .cell. may i know why with that error? i already change the cells to cell. but still did not work. i am stil new in ...
1
vote
1answer
41 views

How to pass a C#.net Dictionary to VBA

I am trying to pass a Dictionary from c# to vba but this error occurs System.Runtime.InteropServices.COMException: 'Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))' I also ...
0
votes
1answer
28 views

Excel forcing Text NumberFormat on a cell with Formula

I am trying to store a formula in a cell. The cell has a NumberFormat set to "@" i.e. Text. When I do: TargetSheet.Cells(Row, Col).Formula = "=A7" And A7 has in it "1805R03-01" I get "=A7" ...
0
votes
1answer
20 views

VBA - Setting counter in loop to copy/paste to next column in master sheet

apologies as this might not be the most technical question. I have been experimenting with this code to try and copy and paste a specified range ("de:e130") into a column in a master sheet and for ...
0
votes
0answers
26 views

How to Filter particular / specific word and cut & paste in different sheet by vba?

I need to filter "MPS" in code column and move those filtered in another sheet by creating a new sheet. code address Part PIT-000000013000835326 1 1 TAP-000000012502567470 1 1 2FRE-65-00-MPS-...
0
votes
3answers
31 views

VBA GetElementsById Method “Object Variable Not Set”

I'm trying to select the main menu ID of this page http://greyhoundstats.co.uk/index.php labeled ("menu_wholesome") in order to get their hyperlinks later on. In the HTML document, there are two tags ...
1
vote
1answer
16 views

VBA copy and paste corresponding data onto new sheet

I am trying to use VBA to ask the user to enter a date. For that date, copy all appointments and paste them on sheet “Daily Appts”, one-by-one. My reference sheet that contains all the data ...
0
votes
1answer
26 views

How to copy data from csv file to other excel files

Since I am new to VBA I created a code which can open a .csv file and copy data from .csv to an excel file without opening both. Actually it works for excel files but When I use a .csv file it ...