Most voted "excel-vba" questions
VBA (Visual Basic for Applications) is the programming language of Excel and other Office programs. Use the Excel-Vba Tag when you have scripts problems of a Vbaproject in direct relation to the interface of Excel spreadsheets.
Learn more…335 questions
Sort by count of
-
6
votes1
answer6469
viewsMacro email range + signature
Good morning. I need help in a macro for sending emails in Outlook 2007. I have a macro that selects a certain range of cells (all right and all down from a referenced cell) and pastes in an email,…
-
4
votes1
answer866
viewsAutomatic Logon in SAP Bexanalyzer by Vbaproject
(UPDATED) In excel I have a supplement that gives access to the BI system, to access / stratify data in a query already specified / structured. In my Vbaproject I am referencing the Add-in to call…
-
4
votes1
answer2153
viewsA Macro to run all Modules?
I have several modules and within these modules I have several subroutines with some functions on separate sheets. I intend to run macros separately! That is, start the next subroutine after…
-
4
votes1
answer3070
viewsVBA+Excel. Code error (incompatible Byref argument type) in Function
The following code: Sub segundograu() Dim a, b, c, delta, raiz1, raiz2 As Double a = Range("B3").Value b = Range("E3").Value c = Range("H3").Value delta = b ^ 2 - 4 * a * c Range("E5").Value = delta…
-
4
votes1
answer1532
viewsCopy and paste cell when changed
I’m starting to use VBA with the office package, as I still know little I’m having difficulties to get this functionality. I was trying to do something simple and I needed help to understand how it…
-
3
votes1
answer831
viewsHow to make a loop "for each" in column P up to the last row filled in VBA?
If you define the entire column P:P the leaf will freeze. How do I define the rng, any idea? CODE: Sub teste() Dim rng As Range Set rng = Range("P2:P300") 'Estou a definir até à linha 300 para não…
-
3
votes1
answer399
viewsSearch column P for a value > or < and calculate this value in cell U?
From now on I want to thank @Leandro Felipe Moreira for the help with the following code: Sub teste() rng = Columns(16).End(xlDown).Row MsgBox rng For i = 1 To rng If Cells(i, 16).Value > "0" And…
-
3
votes1
answer5785
viewsHow to change a cell from "General" to "Number" and add a comma?
I am learning VBA and I had a difficulty to transform a column that has values formatted as "General" for number, besides, I need these values to be expressed with comma. Current values (sample): I…
-
3
votes1
answer137
viewsImage with time interval - Excel
Need to assign an image that appears every 1 hour in EXCEL, how?! It will probably be necessary to use VBA. But I am not very familiar. And close alone after 1 minute.
-
3
votes1
answer4263
viewsHow to copy and paste as image with VBA?
I need to copy a chart and paste it as an image in the same spreadsheet. I’m trying to select the range that contemplates all the graphic and paste special as file Bitmap or Enchanced. Follows code:…
-
3
votes1
answer1679
viewsWhich excel function should I use?
I have a list of names of the masculine and feminine gender that I need to determine in the front cell what is the gender of the name. The logic that analyzes the name and says if it is masculine…
-
3
votes1
answer1262
viewsInsert comment via Function
How to insert a comment with the text of a cell through a Function?
-
3
votes1
answer484
viewsPrint alternate vba excel columns
with the code below: Range("C1:S" & Linha).Select ActiveSheet.PageSetup.PrintArea = "$C$1:$S$" & Linha Application.ScreenUpdating = True Range("C2").Select I can print all columns of the…
excel-vbaasked 6 years, 9 months ago Júlio Faria 55 -
3
votes1
answer663
viewsHow to remove spaces in a text without turning it into a number?
I have some codes that at the time of conversion to excel, appear several spaces and need to remove them via vba, but when I use the function Trim the same converts them into number instead of…
-
3
votes2
answers1314
viewsAutofill - How to select the second line
Guys, I got the following problem: I’m filling a cell with a formula and I need it to be duplicated for the others. So I’m using the code Selection.AutoFill Destination:=Range("C2:C329") Problem:…
-
3
votes2
answers3532
viewsCopy rows from a table that match one criterion and paste into another Excel sheet
Hello! I am something new in VBA and I have obtained what I want through the macros recorder. However, I think that in this case I will not get what I want through this resource. I will try to be…
-
3
votes1
answer674
viewsCopy and Paste data by date - Excel VBA
I need to move some data from one sheet to the other according to the date, but the sealing I made using the IF command only selects the last cell that reaches this criterion ignoring the others.…
-
3
votes1
answer526
viewsHow to "concatenate" multiple values entered by a user in the table in an Msg box?
I’ll try to summarize what I’m trying to do: I made a userform so that my user inserts data that will feed a table, he can put "n" information and the table will form according to the volume of data…
-
3
votes1
answer275
viewsIterate XML with VBA and pass data to cells
I’m starting to mess with VBA now and I have the following problem: I was able to make a code that makes a SOAP request for a webservice and returns me an XML with the data of a person’s electronic…
-
3
votes1
answer95
viewsHow to delete lines from a spreadsheet after performing a filter using VBA?
I am having trouble deleting lines resulting from a text filter in a table. I recorded a macro that resulted in the following code: ActiveSheet.Range("$A$1:$K$161").AutoFilter Field:=2, Criteria1:=…
-
3
votes0
answers254
viewsHow to insert spreadsheet with images in the email body?
I need to put a spreadsheet in the body of an email, but I’m not able to make the spreadsheet images are kept Routine that creates the HTML file from the spreadsheet: Private Function CriarHTML(Rng…
-
3
votes1
answer1636
viewsTextbox returning different decimals in VBA
I have a very simple project, but I have a problem that I cannot solve. I believe the problem is something related to language settings, but all the changes I’ve made so far have not returned the…
-
2
votes1
answer340
viewsCombobox does not update and accepts wrong values
Good, I have this code for a combobox, and I have two problems. First: I can’t get the combobox to accept only the list values Second: the listing has only one value Private Sub TempCombo_Change()…
-
2
votes0
answers414
viewsCopy existing photo in web link and paste special as bitmap in Excel cell via VBA
I am trying to paste image (thumbnail) linked to a link as below: Ex. The main website is: http://www.imdb.com/title/tt0071007/? ref_=nv_sr_7 From this main page, I intend to copy and paste as…
-
2
votes1
answer74
viewsCreate image in another form
I have the following project: When I click the button works perfectly, no problem, but I wanted q the QR Code was generated in Spreadsheet 2 for example. Below the macro code Sub GenQRCode(ByVal…
-
2
votes2
answers2756
viewsChecking and Filling Excel Cells
I have the following spreadsheet as image below, I would like to create a VBA to check if the content inserted in the range of cells of this spreadsheet exists in the list of the second image below,…
-
2
votes1
answer2766
viewsHow to make a Dowload in IE via VBA?
Hello I am using the following code to start a dowload in Intenet Explorer. Public Sub Dashboard() Dim Navegador As InternetExplorer Dim objShellWindows As New SHDocVw.ShellWindows Dim currentWindow…
-
2
votes1
answer573
viewsCounter to insert blank line every 5 equal cells
Hello, I’m trying to make a macro for a button, which puts a blank line every 5 cells with equal content, but I’m quite layy in VB syntax and I’m not sure if the logic is correct either, example of…
-
2
votes3
answers4302
viewsPicking tabs name in a closed spreadsheet
Hello, I have a master list of documents that update itself, it does not open any file, only uses the reference to find the data, but it turns out that some of the employees are changing the name of…
-
2
votes0
answers72
viewsInteract with Silverlight
Good to all, I am developing a VBA system that searches documents (.pdf) on a certain site. However I came across a problem that I had never seen before, the site opens an IE tab with a Microsoft…
-
2
votes1
answer2559
viewsLimit characters and character type
I need some help. I have a spreadsheet this way: And I want to limit the amount of characters and the type In the segment column I want to limit it to 6 characters if it is less than 6 or more than…
-
2
votes0
answers99
viewsHow to use the same supplement . xla on two machines on the same spreadsheet?
I created a file with functions in VBA . xla that can be configured as excel add-on, but after using the functions in a spreadsheet any on my machine and sending the spreadsheet to someone else she…
-
2
votes1
answer578
viewsUnregistered class - Imagelist
When customizing my imagelist and listview appears the following error: Unregistered Class. Searching Object with CLSID:{7EBDAAE0-8120-11CF-899F-00AA00688B10} I believe it is because my Office is…
-
2
votes1
answer2678
viewsOPERATION OF THE EXPLORER VIA VBA
Good morning, I’m starting to work with VBA so my doubt may be very basic, but my problem is the following: When I run the code (below) it looks like an error alert on the 'For each' line' "Runtime…
-
2
votes1
answer4893
viewsHandling of internet explorer using VBA
At the bottom of this site "http://sdro.ons.org.br/SDRO/DIARIO/index.htm" has an icon that downloads a file .xls. I needed to click on it and save the file, but I don’t know how to do it. It follows…
-
2
votes1
answer1337
viewsPass Array as parameter in VBA (Excel)
How do I pass an Array as a parameter to a function in VBA? Detail if I define a type of variable like String, Integer, etc... works, however a type defined by me, does not work! For example: Type…
excel-vbaasked 5 years, 6 months ago Robison Aleixo 139 -
2
votes1
answer1044
viewsVBA - Select a file to attach in the email
Good morning Ladies and gentlemen, this is my first question. I never did, because I always find the answer in some forum, but this time, I lost! So let’s have my doubt. I used a mix of codes on the…
-
2
votes3
answers1380
viewsExcel (VBA) - Copy data from files
I’m trying to gather data from multiple files into a single spreadsheet. In some researches I did through the network, I found several suggestions, and below this the code I found and met the need.…
-
2
votes2
answers790
viewsCheck with REGEX VBA if phone is fixed or mobile (checking 3rd number in regex)
I have to do a REGEX VBA that check the phone number in this pattern, I thought I would try to identify the 3rd number and check if it is different from 9 or 8, getting like this: Cellular…
-
2
votes1
answer569
viewsProblems to close another spreadsheet by VBA
I am running the code below to compare data from different spreadsheets. It is running correctly, but I am not able to close the source sheets of the data. I have tried with '.Close', '.Quit' and '=…
-
2
votes1
answer13169
viewsMerge data from different tabs into one in Excel
I have 18 spreadsheets (tabs) with user data and I need to copy and paste the data into another spreadsheet (tab) of in the consolidated name. I need to copy the header only from the first sheet and…
-
2
votes1
answer4929
viewsFilter dynamic table by word in a cell
This other one just below the same post of the link above .. has difference in running ? ... https://stackoverflow.com/a/43139189/9948374 There is a way to speed up the execution of some of these…
-
2
votes1
answer1378
viewsFilter dynamic table by Listbox
Private Sub Preencher().. From this publication here Filter dynamic table by word in a cell ... It is very efficient in searching column A .... I would like to take the values that are in Listbox…
-
2
votes1
answer100
viewsInclude the value of a variable within another string
I wonder if it is possible to place the value of a variable type string inside another string. Example: Dim name As String Set name = "Bruno" ActiveWorkbook.SaveAs Filename:=…
-
2
votes1
answer1393
viewsReturning value via VBA
I created a database in Excel that should accept only 1 CPF. So I created the following function that checks and prevents repeated entries from being entered. Function verifica_cpf(cpf As Integer)…
-
2
votes1
answer1307
viewsVBA, create a macro so that I can compare two lists of names?
I’m having trouble creating a macro that can check the equality between each cell of a list and, if both are different, leave a blank line above the cell. For example: TO THE B C C D D AND AND F G H…
-
2
votes1
answer566
viewsPosition userform on the same monitor excel is on
Good afternoon, I am creating a Dashboard in which when running Excel a userform is opened, maximized and Excel is hidden. My code works perfectly for a PC with only one monitor. When using a PC…
-
2
votes0
answers282
viewsInsert an image in the Excel spreadsheet with VBA but without the link to the original image
I am creating a table generator in Excel and need to insert several images that are in a certain folder. I make this insertion by the following code: altura = 3 On Error Resume Next For L = 1 To…
-
2
votes0
answers104
viewsVBA-Macro to filter date and paste into a new book if it does not exist, and paste into the last filled cell
Good Night, I am New in VBA and I am trying to develop a macro that makes me the following: I have several data in 5 columns and what I want to do is filter through the [E] column and add a new book…
excel-vbaasked 4 years, 12 months ago Sandro Agostinho 21 -
2
votes1
answer64
viewsVBA - Use one column values to mount table
Good morning, I’m extracting a database with dates and number of occurrences. But for my statistical model I need to organize it in a way that only the dates appear multiplied by the number of…