Newest 'excel-vba' Questions

Q&A for professional and enthusiast programmers

Copy the results into another sheet

I have a sheet where i do some calculus, and i want to copy the full “results” to another sheet, called “Results”. The thing is i have values in columns A and B, C and D, E and F (in pairs, they are ...

VBA to click image placed in a html table

I have been trying to write excel VBA code that clicks on an image that has been placed in an HTML Table. The image which I am trying to click has only the source code. I Tried in 4 different ...

Excel VBA UDF for concatenating is giving an Error message

I'm trying to write a User Defined Function (UDF) in Excel that will take the values in a range of cells, and concatenate them in a certain way. Specifically, I want to concatenate them in a way that ...

VBA Skipping First Matching Cell

The following code is skipping over the first "hit". In "Notes", a cell with "x" in column G will get pasted to the new sheet. However, the first row with an "x" is being excluded each time: Sub Test(...

Msgbox from formula result

I am trying to add a message box if the above formulas return an error or if the cells in the selection are blank, but as of yet have not been able to complete. Any ideas? LastRow = Range("B" & ...

Basic loop (excel not recognizing code consistently)

I am doing a sales dashboard using vba in excel and I have been having trouble with this loop. I have used the same loop multiple times and sometimes it works, but sometimes it doesnt. Excel keeps ...

How to change the value of a cell wiout changing the range?

I have the following columns and data: column1 1(cell A1) 2(A2) 3(A3) Say I want to do like transpose(A1:A3) but want to change the value of 2 in A2 to 0, "inside the transpose formula". Is ...

How to compare data sets and combine based on matching ids in excel?

I know it is very easy to do in databases, but how to do it in Excel? I tried using =vlook(indexcolumn,match(lookupvale,lookuparray,0)) next to ID column in Master set but then when I sort the values ...

excel cell = filename of another workbook

I have a macro for updating a sheet from another workbook, how can I use that same file to update a cell with its filename without the .xlsx. Can I use the vFile or wbCopyFrom Dim? Sub UpdateTSOM() ...

Conditions in Sumproduct if VBA

I have written the following code in VBA and I get a Type Mismatch error in the conditions of the ;SUMPRODUCT;. For Day = 1 To DaysTill For m = 0 To Rot For n = 0 To StepsNumber ...

Copy data from pdf to excel based on unique text avilable in the pdf file and each copied data has to save in a new workbook

I have one PDF file which is having bill summary of thousand mobile numbers. I want to copy each mobile bill summary into a separate excel workbook and name the workbook with mobile number. The unique ...

Worksheet_Event: How to Find a Cell That Cell and Offset 1 & 2 Columns

I'm testing the Worksheet_Event code below. It is doing some weird things. These are basically 3 parts to this code: #1) Enter "EXPL-" & Target.Value #2) Find a cell in Column R with this ...

Two macros on one button in Excel

I have a macro which resets the formatting of a particular worksheet and VBA code which searches for data. I want the button which currently executes the search to firstly remove all of the pre-...

Userform Listbox Change Event Fires Only Once No Matter How Many Clicks

Every time I test the following code, the change event only occurs once, no matter how many times I change the value in the listbox. The values are No and Yes and are populated when the userform ...

Displaying email without sending

I have a code that send or display email automatically. Set OutApp = CreateObject("Outlook.Application") Set outmail = OutApp.CreateItem(olMailItem) With outmail .To = c.Value ...

Update QueryTable and export result as txt file using (Excel VBA)

I try to export single sheet as .txt file after refreshing querytable. I don't want to use Workbooks.Add or .Copy and .PasteSpecial method. So far, I've made this: Do Until i = 5 With Sheets(2)....

VBA TextBox property to store String [on hold]

I'm working on a little Excel-VBA GUI/Form for the user to read and write data from/to an .ini file. Some of the UserForms are created dynamically and I want a method in a Class module to loop through ...

Listing links in designated worksheet vba

I amended the below so the links would go into a sheet of my choosing, but I get errors, I am keen to know is there a way of setting the ws of my choosing. I looked on the net and could not find a ...

VBA add value to rows in columns

I am no expert in Excel so I need some help with some bits of code. This is what my spreadsheet looks like: As you can see, there is a lot of data. I have around 100 pairs of columns, each taking up ...

Find file with a text in spreadsheet using vba and attach to Outlook email

Hi I'm coding in Excel and really need your help to complete the following task. I have an Excel spreadsheet with doctor's ID(Column A)and email address(Column B) and some email options. In a folder ...

Excel VBA Copy/Paste without clipboard

Struggling to resolve this error, when trying to copy a range of column to a new range. I had this code working but crashed and can't figure it out the second time. Sheets("destination").Columns("A:...

Excel Macro append duplicates to first line

I'm an Excel VBA newbie and i'm trying to get the duplicates rows to appends to the first occurence of that row. Per exemple we have the table here I would like to format data as here The logic ...

How do I make a macro that will add a new row with a button that will move when another new row is added

I want to make a table that starts with one row (B14:H14) that has a button in B15 that will run a macro to insert a new row (and copy and paste the formulas from the initial row to the new row). BUT ...

Pivot table count distinct excel 2010

Wanted to create pivot table in excel 2010 using vba. Do we have "count distinct "function in vba because in excel 2010 there was no count distinct?

Copy from one workbook to another using VBA

I am trying to copy data from Source.xlsx to Database.xlsx (from where I want to run the macro). The below from this website does the opposite of what I want to achieve. Can someone help me to adapt ...

Excel Macro to Bold Based on Column Name and Cell Value [on hold]

I have the below code, but I would prefer instead of looking at the entire row for the value to use a column and then value. Example. Column name is "Days" and Cell Value is "Saturday","Sunday". So ...

Excel VBA Worksheet_Calculate event fires for different workbook

Additional information (should make sense after reading the rest): If I open Workbook1.xlsm, then create a new workbook (Book1), I can enter data and formulas, even volatile functions like NOW(), in ...

Excel VBA. Send the datatype of a variable as a variable to a sub

I've simplified my question to make it as generic as possible. Say I would like to create a Sub, which takes a collection, and a datatype of objects expected to be contained in that collection, and ...

how to output values from cells in excel to textboxes with date as search parameter

this is the data in excel screenshot2 I click a date in the calendar and then output the data under that date in the first picture. how can i do it?

Paste the same blck of data below its self twice (or more)

I'm working on a formatting project for a monthly template. The data in column "E" will be static in each work book but different in other workbooks I'll run the macro on. IE one workbook may have ...

Checking Value of Checkbox and setting value for all other Checkboxes accordingly

I am trying to create something like a "Mastercheckbox" that will automatically check all other checkboxes on my worksheet. So I'm trying to start the following VBA Code as soon as I click click on ...

vba code to display 1st date 0f jan or ist date of july based upon a date value [on hold]

I am trying to write a code like if a date value based upon a cell's date value lies between 1st January and 30 june then result should be 1st july and if date value based upon a cell's date value ...

Excel VBA to populate multiple Word pages from one Template

This is what I'm trying to achieve: Design a generic envelope template in Word with bookmarks or placeholders; "Group Name", "Guest Name", "Date". (Completed). Design an Excel sheet to input required ...

***Need Help in Robotics Macro*** [on hold]

I want the help in one of my excel dashboards where i need the automation. I have attached 3 document as per the below:- 1.My Dashboard data 2.Amit_Team Data 3.Harshad_Rec data I want the button to ...

VBA - Excel - Search multiple string through multiple files in a folder

I begin with VBA and programmation. I have a spreadsheet with X values. Each of this values match (or not) with an .xml file in a folder (the value is present in the xml title). What I need is that ...

workbook won't open when opening is called from a workbook that has been itself opened by a third workbook

I face an issue on vba, to explain myself, from one file (let's call it file1), by clicking on a button, I open another workbook(file2), and when reaching this workbook, it asks to open another one(...

MS Excel: insert a row automatically if the content in a cell is <> that in cell of the last row?

I want to add a row automatically if the content in a cell is not the same as that in the cell of the last row? e.g. B1 contains "K1234", B2 contain "K1235" then add a emply row between line 1 & ...

vba sql left join syntax error

I have this query: sql = "SELECT * FROM " & tabla & " LEFT JOIN szlaszamok " & _ "ON tabla.[Főkönyvi szám]=szlaszamok.[Főkönyvi szám] WHERE [Költséghely]=" & smktghely ...

Iterative Solver not solving

So I want to run a solver on multiple bits of data. I've figured out a large portion of it (except for some copy-pasting that's going poorly...), but I'm stuck on the solver aspect - it's claiming to ...

Excel VBA sort method, run time error 1004, “The sort reference is not valid. Make sure that it is whithin…”

I am trying to sort a range based on two different condiditons. In order to do so I recorded a macro that works perfectly. When I tried to replace som of the macro-lines of code into my own ...

Scraping a flight information website

I am very new to this website and also new to coding world. I was given a task of scraping a website for flight-price information. While searching the web, I found stackoverflow and ran the winning ...

prevent userform textbox exit code from running on button click

I have recently started using a userform in order control the capture information in an excel spreadsheet that is then used by a subsequent macro. The form has a series of textboxes and then buttons ...

VBA Vertical scrollbar thumb size

I have a form where controls are dynamically created, the scrollbar included, with Set theScroll = UserForm1.Controls.Add("Forms.ScrollBar.1", "sc1", True) but I'm having difficulty resizing or ...

linking functions from a userform to a sub function

i have created a userform to solve numerical ODEs with initial value problem ie the Euler,Runge-kutta and the rest the userform i want to type the function at where the f(x,y) is, that will link to ...

Multidimensional array and comparing values in each array and give result for each array

I following program to call values to array and compare the values and give a result. I asked this question in another thread. VPA program for compare values in array and give a result (MS Excel) ...

How can I speed up this search in Excel and do I need to start from scratch with the code/can this be modified to this end? [on hold]

I have data in over 1000 cells in one workbook, spread over 10 worksheets that I am able to search through using a button. If I use find and replace the data is found within seconds, but using the ...

Excel VBA - String Conactenation with delimiter

I have a column of cells. They need to be concatenated into a single string with multiple delimiters in between. I need something like the result in column 2 from the values in column 1 Column 1 | ...

Expand selection for manually input data based on macro input data [on hold]

I have a macro that currently finds all file names located in subfolders under a specified parent folder, and list the file names in Column A of a spreadsheet. This data is constantly updated to ...

Write to a text file from Excel range

I'm trying to use Excel VBA to write a range to text file. I'm using the following script which I found: Sub VBA_write_to_a_text_file_from_Excel_Range() Dim iCntr Dim strFile_Path As String ...

Excel VBA validate pdf password

I have created on Excel VBA application to open pdf file with password with Acrobat component. but i want to get the return value true/false when enter correct password (True) and wrong password(False)...
Translating... 0%