Most voted "vba" questions
Visual Basic for Applications (VBA) is an event-oriented programming language with limited object support, used to write macros, available for the entire Office suite.
Learn more…792 questions
Sort by count of
-
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
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
votes2
answers1370
viewsSpreadsheet to discover the ZIP List City
Good morning! I am trying to create a VBA adapted to a spreadsheet that I downloaded on the internet that separates all values of a zip code. I’d like to take the city and stick it next to the zip…
-
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
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
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
answer201
viewsZIP code search via VBA programming
I am developing a solution and the need to add the CEP research has arisen. In return I would like to get the address based on the CEP informed. I intend to use this search to fill out an automatic…
-
3
votes1
answer500
views -
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
votes2
answers7009
viewsHow to delete data from a VBA Access table
I need a command on vba to delete records from my table REPETIRTEL the moment I close my form. This form does not have this table as data source, so I need the command to call this table and then…
-
2
votes1
answer938
viewsVisual Basic Programming in Excel
Using Visual Basic Excel mode, I am creating a customer registration form. It has a button called "new". On this button it would add a value to the Code field that is in the excel spreadsheet.…
-
2
votes1
answer5772
viewsUsing the Excel Application object within Access
I am creating a VBA script that exports a table in multiple shared excel sheets in a specific directory. The problem is that Excel sends a warning to confirm the file save for each file. I would…
-
2
votes2
answers615
viewsSplit in VBA does not work
I have the following code snippet: CorpID = rsSQL.Fields("Name") Tmp14 = Split(CorpID, , 1) Tmp15 = Join(Tmp14) Me.nomeUsuario.Caption = Tmp15 Where I want to find only the first name of the person,…
-
2
votes1
answer4338
viewsCommand for Fill Effect in Excel VBA
Friends, I’m using the tip, described in the "Excel Guru" script in Creating Interactive Maps in Excel: Sub ColorirMapa() Dim Microareas As Range Dim Celula As String For Each Microareas In Range…
-
2
votes2
answers4561
viewsExport data from an array to a table using VBA
In the Sheet1 i have a table only with the Header of each column but empty values, I run a VBA that creates an Array that has the same number of columns of the table. Is there any way to export all…
-
2
votes1
answer61
viewsProblem using common Controls 32 bit in 64 bit
I’m having a problem with common Controls in excel 64-bit(checkbox for example), are necessary to run a code in VBA but in version 64 bit I cannot select them. NOTE: common Controls were…
-
2
votes1
answer1822
viewsConcatenate address in VBA Excel Range Object
I need to concatenate an address in the Excel Range Object and I’m not getting it. The value is an Integer variable. Follow the line of code: Range("O10").Formula = "=SUM(O12:O" & "valor)"…
-
2
votes3
answers888
viewsRange in Excel VBA
I have the following code snippet: ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;C:\Users\Contoso\Desktop\ArquivosDoContoso.csv", Destination:=Range _ ("$A$1")) In part Destination:=Range _…
-
2
votes1
answer962
viewsChoose a file in a folder and save it as text automatically
I want to make a VBA code that opens a specific spreadsheet and save it as tabulated text. I am with this code formulated Sub gerararquivotxt() Dim intChoice As Integer Dim strPath As string…
-
2
votes1
answer196
viewsError placing other parameters in Shell() function
I’m trying to use the function Shell() of Vba in the office 2010, but is returning me the following error: Build error Erra Esperado:= My code is like this: Dim programa As String: programa =…
-
2
votes2
answers501
viewsError canceling file import in Excel
I’m building a Macro for importing a file in Excel. At some point, when the file location is requested, in case the Worksheet cancel import option, the following error message is returned: Excel…
-
2
votes0
answers842
viewsExtract data from a web lead to Excel
I am trying to extract quote data from the following website: https://bancdebinary.com/es/ For this I am trying to use the source code of the site. The problem is that I cannot find in the source…
-
2
votes0
answers765
viewsAccess websites and extract contents to excel via VBA
Hello, I’m wanting to learn how to move around websites and extract images values, or insert passwords and logins via VBA, however I do not know any of this. I would like to know if it is necessary…
-
2
votes0
answers81
viewsSort in array with two dimensions in VBA
I have a array two-dimensional dynamics with: Dates of birth in the first dimension (column) and names in the second dimension: Example: Minhaarray(0,0) = "01/05/1990" Minhaarray(1,0) = "Luisa…
-
2
votes1
answer507
viewsHow to import mysql data with VBA without defacing text
I have a macro that connects to mysql and executes a query that is in text file and adds the records in an excel spreadsheet. It turns out that the text is disfigured. Example: Correct: CALL QTDE…
-
2
votes1
answer3074
viewsAllow automatic sending of email with Outlook
Hello, I need to send several emails to different addresses automatically, but when the VBA starts the sending process opens an alert box requesting my permission to complete the task. Does anyone…
vbaasked 9 years, 7 months ago Raphael Araujo 51 -
2
votes2
answers1188
viewsPerformance Excel VBA vs. Multhreads Calculation
I have an excel spreadsheet of 5M, but with many formulas and more than 7000 lines of code VBA. I would like to receive information on what I can do for the best performance. I would also like to…
-
2
votes1
answer504
viewsADO Command / Parameter in Excel (VBA)
Hello, I am developing a code in VBA in Excel 2010 in conjunction with a database Acces 2010. In this code, I use ADO Command to manipulate the data in the database, but I am receiving an error…
-
2
votes1
answer8849
viewsHow to send only a spreadsheet by email in VBA and not the whole file using the code below
Option Compare Database Option Explicit Public Const C_Title As String = "ef3.Cinco" 'Metodos Public Sub SendMail(obj As MailClass) 'Nome da classe... Dim appOutLook As Outlook.Application…
-
2
votes1
answer1121
viewsCan a macro create another macro?
I have a spreadsheet of analysts, but when you change the analyst or enter a new one I need to copy everything the same as the other analysts just by changing his name. I wanted to know if there is…
-
2
votes1
answer403
views -
2
votes3
answers3061
viewsHow to use a Command Button inserted in the Spreadsheet in the VBA code?
I have a command button that I inserted in a spreadsheet, and wanted to know which function I have to assign in vba code, to know when a user clicks on it !
-
2
votes1
answer630
views -
2
votes0
answers865
viewsWeb Query at Login Site
I need to access a site to make an import of data from the web, but this site needs login and whenever I leave the spreadsheet and enter again I have to edit the query and connect again! The idea…
-
2
votes1
answer1118
viewsVBA Excel - Change Cell between True and False
I’m making a code but since I’m still very green in the VBA I don’t know how to make it work. It’s very simple, I want to press a cell and it will change a Boolean between True and False. When I…
-
2
votes1
answer2607
viewsProblems to click links/buttons in IE using VBA
I’m having a problem to automate downloading data from a site using VBA. The first part goes well, the browser enters the desired page and inserts the criteria into a dropdown list. Just click on…
-
2
votes1
answer667
views"Trace" no (VBA/Excel), how do I get the name of a subroutine?
How do I take the name of a subroutine (VBA/Excel) within itself to use in a code of type "Trace"? (see basic code in block UPDATE after the example code) The idea is to use something like…
-
2
votes1
answer743
viewsHyperlink customization in excel
Does anyone know if there is a way that I can create a hyperlink in an excel cell where the value specified in this cell is passed to the id value of a URL? Example: Cell with value: 100531, when…
-
2
votes1
answer4840
viewsCan you take the button to close forms in VBA/Excel?
I want to take the close button of some forms in VBA/ Excel. For example, I am customizing the presentation of some messages to differentiate from VBA options that are unattractive. In addition to…
-
2
votes1
answer443
viewsTurn multiple columns into one
Hello, I do not program VBA and I am not able to make a code that did the following: |A |B |C | ---------- |1 |6 |11| |2 |7 |12| |3 |8 |13| |4 |9 |14| |5 |10|15| My table has several columns like…
-
2
votes1
answer1137
viewsMicrosoft Vbscript Runtime error '800a01a8' Object required: '[Undefined]'
I have a routine q was working normally in IE 8, when updated to IE 11 it presents me the following message: Microsoft Vbscript Runtime error '800a01a8' Object required: '[Undefined]' Microsoft…
-
2
votes1
answer1247
viewsSyntax error in VBA
I need help to resolve a syntax error in Visual basic of Excel, the command is as follows: Application.ScreenUpdating = False Dim wsh As Worksheet Set wsh = Excel.ActiveSheet Dim data As String Dim…
-
2
votes1
answer4284
viewsCopy a range of Excel cells to an "image" object by VBA
I need to copy a track from an Excel spreadsheet that contains a graphic scheme made with borders around some cells, with some background colors and text, and view this scheme in a VBA "image"…
-
2
votes1
answer972
viewsSkip column to each N counted rows
I need help with vba. When inserting values using Line counter, I want to change column, every N number of rows. E.g.: every 100 rows counted and automatically inserted values, the column is…
-
2
votes1
answer1393
viewsVBA - Interneexplorer Object (Frame)
I need to access a TAG(a) that is inside an Iframe that is loaded in the same page after a Submit. See how strange: When I load the object in the VBA code, I see the Iframe that I need, but the HTML…
vbaasked 8 years, 9 months ago Gabriel Morais 21 -
2
votes1
answer8387
viewsWhen to use Dim and when to use Set?
What are the differences between the Dim and the Set? When to use each? Context 1 Dim minhaString as String minhaString = "Olá!" Context 2 Set minhaString = "Olá!"…
-
2
votes1
answer693
viewsIs it possible to recover the selected values from a multiselect (not active X) list box?
It is possible to recover the selected values from a list box (Form control) with the option of multiple selection, by formula or Vba?…