vba

Spaces while using "Print" in VBA

For some reason I am getting a lot of spaces in front of each value while trying to print to a flat text file. 'append headers Cells(start_row - 2, 1).Select For i = 1 To ActiveCell.SpecialCells(xlLastCell).Column If ActiveCell.Offset(0, 1).Column = ActiveCell.SpecialCells(xlLastCell).Column Then Print #finalCSV, Cells(start...

Excel VBA - Sum up a column

Hi, I'm trying to sum up a column in Excel VBA , however because there are blank spaces, I'm getting 0 as the sum. Dim rExternalTotal As Range , dExternalTotal as Double Set rExternalTotal = Range(rReportData.Offset(0, 0), rReportData.Offset(261, 0).End(xlUp)) dExternalTotal = Application.WorksheetFunction.Sum(rExternalTotal) dExterna...

should i be creating an index for this?

i am adding data from vba excel using adodb into a mysql database everything works great but is slow. the entire process takes about 5 seconds. i believe the reason it is slow is because i am filtering it: Dim rowid_batchinfo As String rs.Filter = "datapath='" + dpath + "' and analystname='" + aname + "' and reportname='" + rname + "'...

how often should i be indexing?

i asked the question of whether an index would help me: http://stackoverflow.com/questions/2961834/should-i-be-creating-an-index-for-this i understand that since i am adding code every time in this procedure, i would need to re-index. in this case is it even worth it to index every time? ...

first Occurrence Of Non Blank Cell vba

Hi, I am trying to write VBA code which works on my Excel sheet. Range("A65536").End(xlUp).Row gives me the row number of the last non blank cell. similarly i am trying to get the row number of the first non blank cell in that particular column. Thanks in advance. madhu ...

Office Trusted locations

I'm curious how to best approach this situation. I have an old VBA workbook that works just fine as is. Unfortunately with the new security measures in Office 2007/2010 you get the "Security Warning Some active content has been disabled" message. I know that I can click on the message and select enable content or add it to a trusted l...

Trim Cells using VBA in Excel

I have what seems like a simple problem with some data in Excel. I have a lot of data with leading spaces pasted from a web table, and I would like to get rid of the initial space. I cribbed the following code (I am completely new to VBA), but it doesn't seem to work. When I step through it in the debugger it looks like an infinite loop....

ms-access: a folder listener?

i don't know if this is the standard way to do things, but i will need to take a text file and have it imported into access. i need access to be always looking (or every minute or so) in a folder, importing the text file, and then automatically printing a report is this possible? how do i have access look in a folder every couple of m...

vba variations across office suite

what kind of functionality variation is there across vba for excel vs vba for access vs vba for word, etc.. i know that probably 95% it's the same. but what is that 5% of differences consistent of? ...

Overcome VBA InputBox Character Limit

Hi, The current function I use to collect text InputBox can't accept more than 255 characters apparently, and I need to be able to collect more than that? Is there a parameter or different function I can use to increase this limit? ...

Can VBA Reach Across Instances of Excel?

Can an Excel VBA macro, running in one instance of Excel, access the workbooks of another running instance of Excel? For example, I would like to create a list of all workbooks that are open in any running instance of Excel. ...

How to change the title bar text of a Userform in VBA?

I'm maintaining an old-ish application written in VBA for Excel 2002 (XP)/2003, and am trying to internationalise it. To do this, I read in the translated strings dynamically and update the various controls on my userform by updating their .Caption property. This works as expected for all controls but not for the form itself -- when I ...

EXCEL VBA help - function to insert blank cell

Hi, I need some help with an excel VBA function. I have data that looks like this ColA ColB a123 a123 a124 a124 a127 a126 a128 a127 .... .... I want to compare the contents of ColA and ColB, Where the contents are different I want to insert a blank cell into column A. So the result wi...

When Creating Macro, What Setting Do I Need?

I have a bunch of VBA code that I'd like to throw in a macro. Basically I call a bunch of subs that update the page. It looks something like this: Call Update1("Work", strConn) Call Update2("Work", strConn) Call Update3("Work", strConn) where Update1, Update2, and update3 are all in the same sheet with the form Public Sub Update1(s...

Word 2007 - How do I convert text with inconsistent tabbing to a table?

I have a whole bunch of tables that were formatted weird, because when a bunch of people make tables out of tabs, one cannot expect the tabbing to be consistent on all of them. For example... I have this table: 2 cols by 11 rows... but I would like a macro that didnt care about the number of columns and rows space space space **column ...

ExecuteExcel4Macro on custom xll functions

I have a C++ .xll addIn for Excel. The following test worksheet function works fine with the xll loaded: LPXLOPER __stdcall Test() { return &xlstring("Yayage",true) } i.e. =Test() returns "Yayage" in the worksheet. xlstring is my own custom method which turns a string into an excel string and specifies whether excel or the xll are...

Worksheets(ws.Name).Range("A" & i & ":G" & i).Copy _ Destination:=Worksheets("Sheet1").Range("A" & emptyCell)

I have this Excel VB code, and everytime after it executes this line, it pauses for half a second: Worksheets(ws.Name).Range("A" & i & ":G" & i).Copy _ Destination:=Worksheets("Sheet1").Range("A" & emptyCell) Can someone tell me what it is doing, and how I can prevent it from taking so long? I have Microsoft Excel 2007 on Windows XP ...

Creating a border around cells with the same value.

I have a table like the one below. How can I get Excel to put borders around groups with the same number in the 4th column so that there is a border around the groups. I was thinking conditional formatting could do it but I can't think how. So I think the only option is a macro. Could anybody help? 1 64436 549419 1 2 64437 549420 1 ...

How to Lookup For something main VBA

Hi, I wanna know how to Lookup For many number in a column A corresponding to a name in Column B By coding in VBA..And Write it in column C??? Thanks in advance..Im new in this... Exemple A B C 200-333 Jack 200-345 Lea 200-346 Fresh 200-347 Tide ...

Runtime Error 424 Object Required

Hey so I get this error in this code: Private Sub Request_Stuff_button_Click() Call Main.createObjects Call My_Control.requestStuff End Sub at the 'Call My_Control.requestStuff' line. The 'Main' module looks like this: Public My_Control As ControlObject Public Sub createObjects() If My_Control Is Nothing Then S...