vba

How to reference cells in a Pivot Table using Field values?

Hi, I have a pivot table created from 3 fields where (for example): field1 values are: "1", "3", "5" field2 values are: "A", "B", "C" field3 values are: "X", "Y", "Z" So given a pivot table PT1 I want to reference a cell within the table in a similar way to PT1["1"]["B"]["Y"] and get a Range item returned. Is this possible? Thanks. ED...

Error 1004: invalid references when creating a pivot table with vba

hi, i've in my excel file a sheet with 3 columns (id,type,month). knowing that many items appearing more than once, i need to get the number of occurances of each id per month then to get the number of ids appearing twice, appearing three times, ... i was told that pivot table is the solution. so i created a pivot table with macro rec...

How to record multiple changes from multiple sheets through Worksheet_Selection change in Excel

I have 5 sheets in my workbook.Whenever I make a change in any of the sheets cell I want to record the change and create new log sheet with sheet name, which cell was updated,what is the updated value etc. How can I do this ...

Excel macro: how do I change all row heights, BUT if cell.value = bold make the cell height bigger?

I'm working on a long list of data (Column B) that has been formatted using bold and indents. The bold cells contain the titles/category names and the indented cell values are the subcategories. The row heights are all over the place. It should have been 10.5 for everything, and the bold cells/rows 15. I can change everything to 10.5, b...

Excel macro: how can I select/treat cells with ending superscript charatcers?

I'm currenlty putting together an If, ElseIf and Else statement to go through the lists and make it standard. The parts where I'm struggling are those cells where a superscript character has been used at the end of the sentaence for footnote references. These cells need to be given specific line heights different from the standard 10.5. ...

Excel 2007 ODBC data populates when opened via Windows Explorer, but not when opened via Access VBA

I have an Excel 2007 workbook that contains an ODBC data connection (to FoxPro, if that matters). The connection is set to "refresh data when opening the file." When I go into File Explorer and open the workbook, the data populates into the spreadsheet as it should. However, when I execute a function in Access VBA that opens the workboo...

VBA to open MyComputer at a specific folder

Hi Ive just inherited an MS Access 2003 system and need a bit of VBA to put behind a command button to open MyComputer at a specific folder to view the files there. The folder name will come from a field on a form. I did have Application.FollowHyperLink "C:\" & Me![ref] (ref is in the format abcd-1234) when its hard-coded it works...

Excel Macro: how do I expand a ROW height to accomodate wrap text?

I'm slowly amending and expanding an If...ElseIf...Else statement (see post) to help me format a long list of categories and sub-categories (thanks marg & Lunatik). I've assigned fixed row heights to 90% of the range/lines. Now I'm stuck on those cells with lots of text that wraps over two lines in a cell. Two lines of text does not fit...

Use Office 2000 proofing tools in Access 2010 Runtime

I am using Access 2010 Runtime to run my custom database application. Office 2000 professional is also installed on the same machine. I use DoCmd.RunCommand acCmdSpelling a couple different place to perform a spell check on the data entered. This works great on the full version of Access 2000 but when I open it up in 2010 Runtime I get ...

Excel VBA: Answer gets "stuck"

I'm new to VBA in Excel 2003. I've written a UDF that takes in two strings: one filter and one that will be a cell reference. When I am debugging and call the function a couple times in a row in the VBA editor, everything works as I expect. But when I use the UDF multiple times in a spreadsheet, all uses show the exact same answer, de...

Complicated Excel VBA Macro with Loop

Hi all. I require help with a reasonably complicated VBA macro loop for a dataset I've been provided. The dataset exists as one long column one thousands of different entries. I've tried recording macros but I am at a loss at the best way to approach it. Any help would be greatly appreciated. In its simplest terms, I need to locate a ...

How to write VBA code to hide all the column and row headings in Excel?

Private Sub hideHeadings() Dim obj As Window For Each obj In Application.Windows obj.DisplayHeadings = False Next obj End Sub The above is my attempt, as when I recorded code to do it it goes ActiveWindow.DisplayHeadings = false. But I must be missing something. Please help thanks in advance. ...

Getting a 400 - bad request when sending an xmlhttp to a wcf using vbscript

we are getting an 400/bad Request when we send a request. Please find our code below. Public Sub test123() URL = "http://dev1.xxxxx.employer/employer/v02/Employer.svc" Dim requestDoc Set requestDoc = CreateObject("MSXML2.DOMDocument.3.0") Dim root Set root = requestDoc.createNode(1, "Envelope", "http://schemas.xmlsoap....

VBA problem with String concatenation

I want to create a query like this : SQL = SQL + "Libelle = \"" + Me.Libelle + "\" AND " because if I have a problem with my data if I write like this : SQL = SQL + "Libelle = '" + Me.Libelle + "' AND " but there is a problem with the \" I'm used to use it in Java (I'm not a VBA developper :s) How to resolve it ? thnx ...

How to find out if an entire row is blank in excel thorough vba

I have a sheet in which I have data from two different sources.I've a blank row between them.I want to make this blank row as my delimiter.How can I find out if the entire row is blank or not. ...

Extract Headings and Pagenumber of Table of Contents of a Word Document with VBA

Basically what we have here http://stackoverflow.com/questions/274814/getting-the-headings-from-a-word-document Public Sub CreateOutline() Dim docOutline As Word.Document Dim docSource As Word.Document Dim rng As Word.Range Dim astrHeadings As Variant Dim strText As String Dim intLevel As Integer Dim intIt...

Closing Excel Application using VBA

I have used the following without success. The active workbook closes, indeed, but the excel window remains open. Application.ActiveWindow.Close SaveChanges:=False ActiveWorkbook.Close SaveChanges:=False Which is the command that terminates the application? EDIT To say a little more: In the workbook Open event I run a macro. I want ...

Unlocking range of cells in excel selected by cellname Office 2007

I have 3 cells which are merged with each other and are referenced to with a given cellname (for example "foo"). I now want to unlock these cells with the locked attribute. The lock in the following code will not work, but the value will be successfully assigned to the cell: Workbooks(loadedSheetName).Worksheets("foo").Range("bar").Lo...

excel 2007 macro select records

I would like to write a macro in vb to select all rows where values in column B contain the characters 'via'. This is my first attempt at macros and not too sure how to begin. ...

How do you get a Range to return its Name?

Dim sampleRange as Range Set sampleRange = Worksheet.Range(Cells(1,1),Cells(1,4) sampleRange.Name = "Range1" MsgBox sampleRange.Nname This will show the actual address of the range, not the name. Why? How do I get a named range to return its name? ...