excel-vba

Print to POS Display Unit

I have an Epson Display Unit (for the Point of Sale), and have it set up as a printer. I can only get it to print what I want when I go to Printer Properties > Fonts (there is a test input box). However printing from an app such as notepad yields no results. I'm trying to get it to work with the p.o.s. app I made in Excel. I found a ...

how to detect whether VBA excel found something?

i am using this to in a macro to find stuff in my sheet: Selection.Find(What:=email, After:=ActiveCell, LookIn:=xlFormulas, LookAt _ :=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False).Activate how can i tell whether or not it found something? ...

excel vba: how to loop through a subset of worksheets

I know how to loop through all the worksheets in a workbook, and how to exit once I reach an 'end-flag' worksheet: For Each ThisWorkSheet In Worksheets If ThisWorkSheet.Name = "FlagEnd" Then Exit For MsgBox "This worksheet name is: " & ThisWorkSheet.Name Next However I cannot get the loop to begin on a 'start-flag' worksheet (or...

How Do I Find The Cells With Contiguous Data In A Row In Excel VBA?

Given the Image... If I know that there is some data starting at Range("B3"). How can I find the cells with contiguous data that is till cell E3? Since F3 is blank G3 onwards should not be considered. The result could either be a range object (B3:E3) or count of cells( 4 in this case). By setting B3 as the Active cell and doing.. R...

How to get the current datetime in UTC from an Excel VBA macro

Is there a way in an Excel VBA macro to get the current datetime in UTC format? I can call Now() to get the current time in the local timezone; is there a generic way to then convert this to UTC? Thanks, Jon ...

Automatically execute an excel macro on a cell changed by a real-time add-in

I have an Excel add-in (Bloomberg) which streams real-time prices into a spreadsheet. I need to add a column which contains the last time a price was updated. I've tried to do this with the worksheet change event, but this doesn't seem to get fired by the changes (I assume something to do with it being a real-time update). The requireme...

VBA Cannot return a custom Hashtable from a Public Function

I have a Hashtable implementation (in class modules folder). But I get a strange (long) error, for which no help is provided.. Error throws when I make the Function that return Hashtable Public. It says: "Private object modules cannot be used in public object modules as parameters or return types for public procedures (**this is what i...

VBA UserForm Array

Currently, I have an Excel spreadsheet with some data and a command button that creates a UserForm that displays a subset of that data. The UserForm has been designed in a way that makes the data easier to view. The problem that I'm having is that I would like the command button to make multiple instances of my UserForm so that each form...

User Defined Multiple Column Sort in Excel

Hello, I have few hundred rows of data in four columns (varA, varB, varC, varD). I want to write a macro such that a user can define the sort order of these columns i.e. first sort by varD, then by varA, varC, varB...so on and so forth. In all there are 4! or 24 different permutation possibilities. I DO NOT WANT THE USERS TO GO DIRECTLY...

EXCEL VBA - To open a text file from a website

I want to read from a read the text file from a website such as www.site.com/example.txt and update an tabs in an excel sheet accordingly. Is it possible using excel VBA? Can you advise some examples? ...

Why is Excel giving me error "Cannot shift objects off sheet"

I have made a minor change to an Excel macro, and although it worked on the sheet I developed it for, it errors on a similar sheet. The change simply adds a couple of columns, sorts the data by those columns, and then removes them again. The only difference between the two sheets is that AutoFilter is turned on in the sheet that erro...

Excel VBA: Is Open Workbook an Attachment

Is it possible to tell if a workbook has been opened from an email attachment, rather than a drive/share? ...

Match value from a table and print the results on a column

I would like to build an excel VBA program to find all the match values from a table and print the finding on a column... I tried to use vlookup but only gives me the first location that finds... and I would like all the finds. here is an example: my table starts on cell A2 column A (number) 0084 0084 0085 0085 0086 0087 column B (l...

Combining IF else with LEFT to hide columns

Hi Guys I'm trying to write some code to Hide columns if the first 3 characters of cells in a range equal the contents of another. I have the code for hiding columns if cells in a range are blank as this;- Private Sub Worksheet_Change(ByVal Target As Range) Dim r As Range, cell As Range On Error GoTo ErrHandler Set r = Me.Range("C8:R8...

How to set an array value using sp_OASetProperty

I have a stored procedure that manipulates some data in an excel spreadsheet. I am importing data by creating a QueryTable object. I would like to set TextFileColumnDataTypes property for the object but I can't figure out how to pass in an array to the sp_OASetProperty routine. This is what my code looks like but obviously it doesn't wo...

exporting reports from access to excel 2007

hi i would like to know what would be the code if you want to export your report from MS Access 2007 to Excel 2007? I just migrated a database from MS Access 2003. And in the old databases I can export reports to excel. Could somebody tell me? The button idMso="Export Excel" in Ms access seems not to work. Additional I was able to ...

FileSearch strictness issue

I'm currently trying to search directories for any file labelled "??.??.????.xls" (for mm.dd.yyyy.xls). The problem I have is that the code I'm using also matches filenames such as "my-restaurant.12.01.2006.xls". I only want to match filenames with specifically the notation I used above. Dim Invoices As FileSearch Set Invoices = Appli...

Excel VBA: how to programmatically remove the marching ants after range.copy

I don't want to resort to SendKeys "{ESC}" ...

Range limit conundrum

Hi, Is there some limit to what I can select in a range via VBA? Basically what I found is that if I were to hide an entire row while in a loop, it takes quite a while if there are lots of rows to hide. ex) - Hide any row that doesn't have a value in column A For i = 1 to 600 With Range("A" & i) If .value = vbEmpty then ....

Adding Larger Icon On Excel 2007 Ribbon Button

I've got an Excel 2007 VBA script that adds a button to the ribbon, but unfortunately the icon is tiny. I tried several different FaceId's, but they all seemed to add tiny icon buttons. Is there a way to load in some of the newer 2007 size icons? Here is a snippet of the code that I've got loaded in ThisWorkbook: Set NewButton = Ne...