vba

How do I create a macro that would hide and show columns based on selection from a dropdown?

Hello I am totally new to the world of macros but have done some VBscript on QTP before. I am looking to create a macro which would hide certain columns depending on the users selection from a drop down. I am unsure of the syntax and how to identify the columns I wish to hide and how to identify the cell with the dropdown. Here's roug...

Named Cells Are Going Wacko, Corrupt File?

Hey SO, Whenever I click in a cell, and try to rename it, I get an entirely new reference to it, and the old one doesn't delete. This wouldn't be a problem if I could delete the old reference, but if there is something wrong with the file, this might not be the best idea. Is there any way to delete existing name references to a cel...

Init Date variable with null value

Simple question: how can init a Date value with a null value in VBA? Dim DateStart As Date DateStart = Null doesn't work. EDIT: I was just wondering if it's possible. In the beginning of my code I want to set the value to blank, halfway it will be given a value in most cases, if not, later on I'll request the value and if still blan...

Application Defined or Object Defined Error (Excel VBA)

I keep getting an error 1004 for this line in my VBA Macro Editor: If ActiveCell.Name.Name = "DayShift" Or ActiveCell.Name.Name = "AfterShift" Then Does anyone know why? This is my whole macro: Private Sub Worksheet_Change(ByVal Target As Range) Dim col As Integer col = ActiveCell.Column Dim bValue As String Dim cValue As String 'C...

Table heirarchy in Excel, using Excel as a form with repeating tables

Hi, I am creating a form using Excel. The form will be populated upon creation from outside data, but there will be room for users to enter (but not remove info). I need to have repeating tables. I have created my own version of repeating tables( not using Excel's concept of "table") and I have hyperlinks at the bottom of each table t...

Is it possible to hit a WinForms "Button" from an Excel spreadsheet (VBA)?

Hi, The traders are lazy and they don't want to switch applications to hit buttons. When they hit the button in Excel, it should be the same as hitting another button in my WinForms app (which pops up a dialog box). Doable? ...

complex EXCEL IF formula or VBA

i have this data set: 92127 96001-1 94533-1 95630 95677 95630 i need this output 92127-1 95630-1 95677-1 95630-2 here is the logic: if 92127 does not exist in this column, then it should be 92127-1; however, if it DOES exist, then it should be 92127-(what ever the largest number is here +1), so if the largest one is 92127-5, then ...

ms-access: can a control source be plain text?

i need the control source for a textbox to simply be "x" i have a bunch of textboxes on a report and i need each text box to just have an x in it ...

Insert inline image into Lotus Notes message

I've been able to send emails using Lotus Notes and VBA and Python using the COM API like this: http://stackoverflow.com/questions/1027400/can-i-use-lotus-notes-to-send-mail My question is how can I insert an image inline with the body text (not as an attachment) in a programmatic way (equivalent to the Edit | Paste Special)? I haven't...

Strange behaviour in Access 2003 VBA code

Looking to see if someone can tell me a cause/hotfix/serivce pack to resolve this. Already tried: decompile/recompile import everything into a clean database decompile/compact/recompile in clean database Happens in both MDB and the MDE version of the code This issue affects calls to both user defined and application defined functions....

'this' pointer in VBA

I'm new to VBA, so this might be stupid. Is there an equivalent of 'this' pointer in VBA so that I can pass it to other module? ...

In VBA Excel when I copy one cell to another, if it is a date it is not copied, what do I do?

This is probably quite simple but I've googled and can't find an answer. I am also just learning VBA (I have done VB.NET etc. etc.) If the cell the macro is trying to copy is a date I just get a number copied, e.g. 40352 from 23/06/2010 Here is a code snippet, any help most appreciated, thanks: Sheet5.Range(Cells(rwStartNumber, curren...

Insert checkbox and VBA code into Excel using Powershell

Hi gurus, I need help on how to include a checkbox into Excel and make a Msgbox appear saying "Hello" when it's ticked. That's not really what I need to do though, but I can find my own way from there. This should be done using Powershell. Just to get started. $missing = [System.Type]::missing $excel = New-Object -Com Excel.Applicatio...

How to get rid of VBA security warning.

Hey guys, I developed a Access application using VBA. Everytime I open access up, I get the following: I have to click Options -> Enable Content to run my macros. This application will be shared among a couple of people at work who are not so tech savvy. So as per requirements, I must remove it. I've tried signing/packaging the datab...

Building Forms for Outlook 2007

I was just introduced to the concept of Outlook forms. I don't know if this will solve my problem but here is what I want to do: I want to be able to have employees who are inside the company fill out some forms. So all I have to do is create the form and PUSH it to their Outlook? After they fill out the form, can I capture the data som...

Excel VBA: Getting the average of a column with unknown size

I am writing a Macro that requires me to get the average of the values in a column with an unknown number of rows. I use this to get the number of the last row: Dim lastRow As Long lastRow = ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row That works. What doesn't work is when I try to use it here: Range("B2").Select Activ...

ms-access: how to fit VERY long condition in conditional formatting

i have a very long condition. it's about 3000 characters access has only space for about one tenth of that. is there some other way to set conditional formatting on a textbox besides through the dialogue? can i do it in VBA? if so HOW? i have conditional formatting on a bunch of textboxes that trigger when the report is opened ...

ms-access: single and double quotes in conditional formatting

does it matter which quotes i use when i do conditional formatting? for example some_field='this' or some_field="this" does it make any difference? ...

Can't load xll programmatically

I'm trying to automating some tests for an Excel add-in, which is in xll form. I have some problem in loading the xll. I'm writing it in C# and my code looks like this: using Microsoft.Office.Interop.Excel; Application xlApp; Workbook xlWorkBook; Worksheet xlWorkSheet; // create application, open workbook, etc ... // now try to regi...

using IF statement instead of conditional formatting

since it seems that my conditional formatting statement is way too big: ([Panels] like '*IT_AMPH,*' or [Panels] like '*AMPH_SN,*' or [Panels] like '*AMPH_S,*') and ([Panels] like '*IT_BARB,*' or [Panels] like '*BARB_SN,*' or [Panels] like '*BARB_S,*') and ([Panels] like '*IT_BENZ,*' or [Panels] like '*BENZ_SN,*' or [Panels] like '*BENZ_...