I have the below formula to make a simple calculation:
=SUM(AC1880+AJ1880)
I would like to adapt the formula to ask IF AG1880 is empty or not. If AG1880 is empty then I would like the formula to NOT make the calculation, but instead return "--" (nothing).
If it contains information, then I want the calculation (AC1880+AJ1880) to be made. If AG1880 contains information it will be text in a text format.
I am creating a user input form where the user can enter data about what they have eaten on a certain day. I am using radio buttons, so when the radio button has been clicked, it automatically puts something into cell A1. What has been put into cell A1 will then be used to say what is in the combo box named Cbo_FoodItem. I have used the following With Me.Cbo_FoodItem If Worksheet("na").Range("A1") = "carbs" Then Cbo_FoodItem.List = Worksheet("foodtable").Range("B2:B215").Value End If End With
However, when i try to test it, i get an error which then highlights the "Worksheet" after IF and says "Sub or Function not defined". Obviously there is something wrong with the formulae, however i cannot work it out. Please help. I've only just started using visual basic, but i am starting to get the gist of it.
I would like to do is develop a stand alone program in Visual Basic ( not in Excel VBA) to update the price file in our Portfolio system automatically using the downloaded Excel format file csv extention file from the BigCharts. But before that, I need to export the *.pri file from our Portfolio system in to Excel which still saves as *.pri extention. Then once it updates, I import the updated *.pri file back in our Portfolio program. I understand that the Excel VBA code can be incorporated in Visual Basic code provided there is an object declaration for Excel file (In this case eventhough the both files are in Excel format, they don't have xls extention). how to use external files and Excel VBA code in Visual Basic?
Below is the code that I currently have in Visual Basic. What I'm trying to accomplish is using the ticker (eg. msft) as a keyword search to look up in the price file. If found , the price of that ticker from the test.csv file will be copied in to the price file which is test.pri. I haven't ran it yet.
Sub UpdatePrice(BigChartPath As String, BigChartName As String, AxysPricePath As String, AxysPriceName As String) 'Below are Excel VBA codes 'Uses the test.csv to look up tickers in test.pri and update the price in it Dim PriceFile As Workbook, BigChartFile As Workbook Dim PriceFileSheet As Worksheet, BigChartSheet As Worksheet Dim MaxRows As Long Dim PriceFileRow As Long Dim BigChartRow As Long Dim BigChartFound As Boolean Call CheckBookOpen(BigChartPath & BigChartName) Call CheckBookOpen(AxysPricePath & AxysPriceName) Set BigChartFile = Workbooks(BigChartName) 'Big Chart website imported CSV file saved as test.csv...............
I have a spreadsheet containing all products in sheet 1. I have a list of promotional codes in sheet 2. In sheet 1 I want to say 'If cell A2 is contained in column B of sheet 2, then say YES, if not then leave blank'.
I've tried the following but it doesn't work:
=IF(VLOOKUP(A6,Sheet2!B:B,1,FALSE),"Yes"," ")
I get #N/A when the item is not in sheet 2 and #VALUE! when it is.
I'm trying to use loop to activate 3 workbooks "OSB1", "OSB2", and "OSB3" and their respective sheets. "OSB1" has sheet "OSB1" in it, workbook "OSB2" has sheet "OSB2" in it etc.
The digit on the end of each OSB is the variable I am using in the loop.
What I am trying to come out with is the following 3 workbooks and sheets being activated:
I have the following sendmail macro. However I need the "To" section to be the result of a lookup in a worksheet. The specific function that i need it to be is: =VLOOKUP(A837,'Tenacity Jobs'!1:65536,5,FALSE)
How can I incorporate this function so it will insert the result of the lookup into the "To" box ?
The following code (blue font) finds specific worksheets in an active workbook, and copies them into a new workbook then names the new workbook the same name of the worksheet. It all works perfectly.
The second code below (red font) imports some vb into the new workbook. It works fine if I manually open the new workbook and run it in the immediate window. However, I would like to incorporate the red code into the blue code so it all runs as one. I've tried inserting the red line after the "ws.copy after" line and after the ".saveas" line, but no dice.
For Each ws In wb.Worksheets If UCase(Left(ws.Name, 2)) = "CC" Then Set NewBook = Workbooks.Add
I have a number of files organised in a number of folders on Dropbox. I create a macro to enable me to be able to navigate to a particular folder and then get a list of all the files in that folder to be placed within certain cells on the spreadsheet I'm working with in Excel.
I'm trying to create a dynamic Named Range using VLOOKUP in place of a sheet name. (Using Excel 2003 & Win XP Pro SP2).
To illustrate:-
Employees.xls contains employee's details on separate sheets for each department, e.g. Production, Admin, Sales, Personnel, etc. Each sheet is 12 cols. and 1 header row. Sheet 1 of this book contains a 2-column Master List of all employees and their departments. MyBook.xls has an employee's name in A1.
I can get his department by using =VLOOKUP(A1,MasterList,2,FALSE) and what I want to do is incorporate that into the following in place of 'Admin' so that the range will refer to the correct department for whoever's name is in A1.
I'm trying to write a macro that will analyze data from one spreadsheet and do a regression. The information I want to be output on the same sheet. I tried to use the record function, but I got an error. It said "Run-time error '1004': ATPVBAEN.XLA could not be found. The code read:
Part of the data I'm collecting from a CSV file is in the form of a hyphenated materials specification. In the current system of manually importing and formatting the tables from the CSV file, the formulas
are used to separate the two components of the specification.
For example, a material specification of 362S162-43 would be separated into "362S162" under one column and "43" in the next.
The quotation marks are giving me headaches when I try to write the formulas to the appropriate cells using VBA, however. I've got an understanding of what the formulas mean, but I don't know how else to go about splitting the relevant information at the hyphen with another technique.
I am currently using an Intersect statement in a worksheet module to perform two things: 1. Insert a time stamp into row 2 when row 1 has a price inserted 2.To clear that time stamp if the price is deleted at some later date.
My problem is with the time stamp value being deleted by the user. If I try to clear the price (now that the time cell =empty) I get a Runtime error 91 - Object Variable or With block variable not set.
I would like to convert this code to a select case statement but I'm not sure how to do this in this situation. Would error coding be appropriate in this instance?
I have been working on an app for a while now and it works for all our PC users. We have some folks in corporate who have macs and the thing just falls on it's face. So, I have taken out the vba on the thisworkbook start up bits in hopes that it can just open and go from there. This is also problematic. So in search on the web, it looks like Macs do not like VBA. So I decided that since the main page entry is just standard formulas, I would just remove all the modules, forms and macros out of the workbook so the whole problem side could be avoided. Well no such luck. When I open it, it asks about macros. If I disable them, it tells me that the macro can not be disabled in 4.0. I built the app in 2000 as it is the lowest version in the office. But this really shouldn't matter because there are no macros in it to start with.
So, my question is... How can I make a very basic, mac safe version from my PC version. I can draw up some VBA to open the mac version and suck in the info I need and save it to PC land.
I have read from the help file and online that in order to tell if a checkbox is checked or not you use the code
chk1.CheckBoxState
When I click the checkbox it doesn't work, says data memeber not found
if it helps i am using the code in the ch1.click sub, if that matters (I want to make if so if the check box is clicked, some text boxes are no longer enabled, the only thing i have trouble wth is the fact i can't tell if its been checked or not)
Need little bit of information concerning excel. Where is the whiteboard located. Second, how can i highlight a cell or multiple cells. Finally, i need the Data Analysis Plus add-in. Any idea where can i download in from.
I used to use VB and VBA years ago for fun, now I have a project at work and I havent touched it since 1999 at least. I am trying to program a function that I can call and pass it a text variable. It will search through excel for that text, and return a cell as a Range. Thats where I run into problems. Heres the
Function lookFor(text As String) lookFor = Columns("B:C").Find(text, After:=rCell, LookIn:=xlFormulas, LookAt:= _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _ , SearchFormat:=False).Address End Function
'...then later in the code...
Private Sub search_idBTN_Click() '... Dim rCell As Range Set rCell = lookFor(searchTXT) '... End Sub
I think it has something to do with the variable type, its expecting a range and it gets a string or vice versa or something.
how I can get to the visual basic toolbar in excel 07. In previous versions there was a visual basic toolbar and it allowed you to add buttons, ect. Where is this in 2007?
I'm trying to put together a basic spreadsheet to track offensive plays for high school football. I'd like a formula that will change the LOS (Line of Scrimmage) to reflect the yards gained on the previous play. The problem is that you'd probably need negative numbers up to 49, and then back down to 0.
I want to be able to put password protection on a button in a spreadsheet. It doesn't need to be secure, as it's just to prevent accidental changes by 4 year olds.
My plan was to store the password value on a hidden worksheet, as I don't think there's a way to retain the value of a VBA variable when a workbook is closed. Is there a neater way to do it?
Is there a code you can type in to VBA to allow a picture in a spreadsheet to change when a parameter is specified. For example i have a picture of a timber beam i drew in excel. and i wondered if i could set it up so that when the user inputs the length of beam they are using, the diagram alters to show the length specified.
My company "makes widgets". Each "type of widget" is associated in our internal database with a record locator (five alpha characters). Our company website can also use that record locator to pull up a webpage specifically dedicated to that widget. In addition to the webpage itself, the website also creates an expanded URL which contains additional information about that widget.
I'd like my macro to take a list of record locators, open up the company website related to each specific widget, pull back the expanded URL, and do some text management with the URL to populate other parts of the spreadsheet.
For example, if my record locator is "ABCDE", my macro would go to the website, "http://www.widgets.com/ABCDE". The site then redirects to an expanded URL: "http://www.widgets.com/whole-bunch-of-data-about-the-ABCDE-widget". I'd hope to write a macro which pulls back the expanded URL and does some magic with the "whole bunch of data" part. I've been told that the MSHTML library would be useful for a project of this type. I've been able to connect my spreadsheet to that library, but then I'm not sure what to do with it.
I am trying to accomplish the following: iterate through rows of a selection, delete row if the first column cell is empty or the second column cell equals 0.
So far I have:
[Code] ........
I am getting a type mismatch error at my if statement.
Have a project going and have had a disturbing trend develop. I'm working in Excel 2003. Upon opening the file and enabling macros, I started receiving File/Path errors, at which point it would shut down the application. When opened, I have a splash that would come up, but it wouldn't go to the next userform. At this point I would get the error message and the file would be closed. If I then reopened the file, disabled macros, saved under a different file name, and then reopened with macros enabled, everything worked fine, until I shut it down and then tried to reopen, at which point the same error would occur.
Lately I have simply been getting the Microsoft Excel dialogue box telling me an unexpected error occurred and it had to be shut down. I'm at a loss for what is causing this. The last time this happened, when Excel recovered the file, it told me a repair had been done, and the repair was to basically delete all of the VBA code from the file.
I am encountering a situation wherein each line of VBA code is essentially compiled as I type on that line, instead of when I move to a different line. For example, if the code I entered is incorrect, the compiler waits about half a second and then turns it red. Also, if I enter a space, it deletes it immediately.
I'm sure this is something I've accidently pressed while using VB. My text cursor has changed from the usual 'I' shape to a black box shape. Now instead of adding text where I'm typing it now types over previous work. Is there an easy fix for this.