excel-vba

VBA: jumping out of a for loop

How do I achieve the following? Sub Macro1() ' ' Macro1 Macro ' ' Worksheets("Drop-down").Select n = Cells(1, 1).End(xlDown).Row For i = 1 To n ActiveSheet.Cells(i, 2).Select ******************************************************* If Worksheets("Misc").Cells(2, i).Value = "" Then continue...

10 users need to be able to run the same macro in excel

i have a server where resides an excel macro there will be about 10 users on 10 different workstations that will need to run that macro on their own worksheets. how do i run the macro from a centralized location by multiple users who want to run it on their own worksheets? the reason i need it centralized is because the macro will nee...

Using "wildcards" in a vlist array to delete rows in Excel

Good Morning All, I'm trying to setup a vba macro to delete all user IDs out of a spreadsheet that do not start with designated prefixes (e.g. US, A1, VM, etc). The below block of code was found on the Code Library and looks to be what I need but there is one problem: When I enter in UserID prefixes into the vlist fields, it treats them...

creating an excel add-in

can someone please get me started on the following: i would like to package an excel macro as an add-in to excel. the macro will reside on a central computer, where 10 other computers will connect to. how do i create an add-in that will be constantly updated ? ...

MS Excel 03 - Deleting rows that have live string identifiers in column A, while concatenating other values

I have this xml document that is provided as a data feed (right off the bat I can not modify the source of the data feed) and i import it into excel with the xml import. there is no schema that comes with this xml so i get a table that ends up having a whole bunch of duplicates for an identifier, because of the unique values spread throu...

vba: read only first 1000 characters of file into string

i need to open a txt file and read it into a string in VBA, but i would like to only get the first 1000 characters. the file itself is 20mb and i only need the first 1000 characters. is there a way to make this efficient? ...

vba: get location of current worksheet

i wrote a macro that is an add=in it needs to figure out the location of the current worksheet on which it is being executed. how do i do this? i need the file location (directory) ...

running a macro from an add-in

i have an add-in called book1. inside the addin there is a module called module1 which has a sub called addin1 i would like to run the macro addin1 from a different workbook i am trying to call this macro like this: Call Addin1 but that's not working and i tried: Call book1.xlam.Module1.AddIn1 which is not working either does a...

Excel VBA Text To Column

This is what I currently have: H101 John Doe Jane Doe Jack Doe H102 John Smith Jane Smith Katie Smith Jack Smith And here is what I want: H101 John Doe H101 Jane Doe H101 Jack Doe H102 John Smith H102 Jane Smith H102 Katie Smith H102 Jack Smith Obviously I want to do this on a bigger scale. Th...

what does this ADO OPEN Method do?

in plain english can you explain to me what happens here: rs.Open "batchinfo", oConn, adOpenKeyset, adLockOptimistic, adCmdTable what i need to do is to be able to insert values into a table called batchinfo. would this be the best way to do an OPEN? the only thing i would be doing is inserting values. ...

VBA Excel 2007 macro dies in Excel 2002

Hi, I have just tried to send a workbook to a friend that has a chart with a drop-down box on it. In excel 2007 I have used: If Chart2.Shapes(2).ControlFormat.ListCount = "16" Then To check the size of the list so that it doesnt get entered in again (resulting in an extremely long list that repeats itself). This line works well in Exc...

Named Range Breaks Code

I have one workbook with several sheets. I populate the listboxes (pulling static data from cells) on the 2nd sheet, click a button and it runs fine. When I populate the listboxes with a named range, the listbox populates the way I want, but I get an error because the code thinks that I didn't select anything in the listbox, even though...

vba: funny notation with #??

what does this mean? if CDbl(Trim(Range("M" & r).Text)) > 0# then... what does the # do?? and what does cdbl do? ...

Subscript out of range error

Private Sub sendemail(esubj) ROW_BEGIN = 1 ROW_END = 72 Sheets("Input").Select Range("A" & ROW_BEGIN & ":S" & ROW_END).Select Range("A" & ROW_BEGIN).Select fileL = "\\fire\school\FINANCE\Report\FY10\Key Indicator\" fileL = fileL & (Left(Range("I7"), 3)) & Right(Year(Date), 2) fileL = fileL & "\Key Repor...

VBA Macro to save an excel file to a different backup location

I am trying to create a Macro that either runs on close or on save to backup the file to a different location. At the moment the Macro I have used is: Private Sub Workbook_BeforeClose(Cancel As Boolean) 'Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) 'Saves the current file to a backup folder and the...

Excel VBA macro workbook startup - security warning - automatic update of links disabled

I've created an add-in and installed it, but now when I open Excel I get an error pop-up telling me that the add-in file is a security risk and that automatic updating of links is disabled. I've looked it up and it refers to the Windows DDE protocol, but what does that have to do with this add-in? Does anyone know what's happening behin...

MS Excel automation without macros in the generated reports. Any thoughts?

Hello! I know that the web is full of questions like this one, but I still haven't been able to apply the answers I can find to my situation. I realize there is VBA, but I always disliked having the program/macro living inside the Excel file, with the resulting bloat, security warnings, etc. I'm thinking along the lines of a VBScript th...

Add Contents of Cell to VBA Query

I would like to update my code to include the contents of a cell, S3. Right now the cell has the value of 'Test, Testing, Tested' and the relevant part of the query looks like this: SELECT * FROM dbo.Total WHERE ID = " & TextBox1.Text & " And Source IN (What do I put in here?) Your help is much appreciated ...

Create Macro With Several Variables

I have several worksheets with similar code, so I'd like to turn it into a macro. My only problem is that there are several variables. So at certain points the code looks like this: Dim Msg1 As String Dim Msg2 As String Public Sub ListBox1_LostFocus() ListBox1.Height = 15 With ListBox1 Msg1 = "'" For i = 0 To .ListCount - 1 ...

Stuck. I need some VBA code to insert double-quotes around strings in each cell in an excel range.

I'm familiar with VB.NET, but VBA in excel has me stumped. With my best attempt, I get a "Type mismatch" error: Sub AddQuotes() For Each x In Range("List").Cells x.Text = "*" * " & x.text & " & "*" Next End Sub ...