VBA syntax

If I define Cell B5's Value to be $2000
what is the VB syntax that Cell B5 will now shows "$2000"?
Sorry, this is very basic
Thanks,
SUNAN
0
Sunantoro (20)
9/21/2005 1:57:01 AM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
410 Views

Similar Articles

[PageSpeed] 56

with cells(5,2)
	.value = 2000
	.numberformat = "$#,##0"
end with

Hope this helps
Rowan


Sunantoro wrote:
> If I define Cell B5's Value to be $2000
> what is the VB syntax that Cell B5 will now shows "$2000"?
> Sorry, this is very basic
> Thanks,
> SUNAN
0
9/21/2005 2:19:18 AM
Reply:

Similar Artilces:

VBA to delete 200 Reports from MDB
I was given this code that would delete Queries starting with ~. And I thought maybe I would be able to use it to delete 200 reports, but I obviously do not understand this well enough, would someone please provide me some insight?? I looked at the MSysObjects table and figured that since all Reports are of TYPE = -32764 maybe I could change this line If VBA.InStr(Qdef.Name, "~") = 1 Then to If VBA.InStr(Qdef.TYPE, -32764) = 1 Then I have discovered that Qdef.name does not represent the fieldname NAME ??????? Thank you to anyone who helps.. This is what I started with>...

VBA pasword
How secure is the micrsoft excel VBA password ? The password secures the VBA so that no one can see the VBA code but is it easy to break the password ? Commercial crackers can break the password. Even when protected, the tokenized code is visible in a hex editor. It's not necessarily straightforward to read, but it's easy to get the gist. For one, very simple instance: Option Explicit Public Sub GoToEndOfColumnB() Range("B" & Rows.Count).End(xlUp).Offset(1, 0).Select End Sub appears in a hex dump as 41 74 74 72 69 62 75 74 00 65 20 56 42 5...

Dlookup() syntax
Hello: I am having a problem with the syntax for dlookup. I am trying to find the TARE (empty) weight of a vehicle in a table called TBL_MSW_VEHICLE by searching on the ACCT_NUM and VEH_ID. TBL_MSW_VEHICLE Fields: ACCT_NUM - Number VEH_ID - Text TARE - Number FORM: CMBO_ACCOUNT - Account combo box in form CMBO_VEHICLE - Vehicle combo box in form FLD_TARE - Vehicle empty weight in form CODE: Fld_Tare = DLookup("[tare]", "[tbl_Msw_Vehicle]", "[acct_num] =" & [Cmbo_Account] & " And [VEH_ID] =...

One workstation multiple versions of VBA
I have a client who has multiple versions of forms, reports and vba - essentially one set of code and modifications for a given group. We are trying to sort out how to easily facilitate testing this on one workstation without copying files in and out of a specific directory. I'd like one folder per person or group and in this folder have that group's reports, forms dictionaries and VBA files with 1 dynamics.set file for each person pointing to that person or group's files. I don't think I can do this without also copying the code dics to the individual folder as well ...

VBA project unviewable when moved from Windows to Mac
I'm hitting a strange problem. I've got a large project that I'm porting from Office on Windows to Office on Mac OSX. On Windows, I open the project in the VBE, then tell it to remove protection, so it'll be viewable without a password. If I close Word, reopen that file, and go back into VBE, I can view the macros just fine. I move the file across my network to my Mac. Open it, and try to access the macros in VBE on the Mac, and I get a Project locked for Viewing message. Furthermore, there's no opportunity to enter a password and view the project. Can anyone help with t...

Error handling in VBA
Hi guys, I'm not so used to the On Error statement, ssince I come from a Fortran background where all error handling must be performed using If Then Else constructs. Example: in this interpolation subroutine 'Returns an interpolated value of x 'doing a lookup of xarr->yarr Public Function Interp1(xArr() As Double, yArr() As Double, X As Double) As Double Dim I As Long If ((X < xArr(LBound(xArr))) Or (X > xArr(UBound(xArr)))) Then MsgBox "Interp1: x is out of bound" Stop Exit Function End If If xArr(LBound(xArr)) = X Then Interp1 ...

What VBA Stmt Will Tell Me What a Chart's PlotNo Is?
I have a regular worksheet (not a chart sheet) that has 10 charts. I have written a macro that will allow the user to change the row limits of the SERIES formula. The macro works, but critical to making it work is knowing what the "PlotNo" (chart number on the sheet) is. What is the VBA statement that will tell me what a chart's Plot number is? He also needs to specify the SERIES number, but he can determine that by selecting the graph he wants to change. The two main statements I'm using are: Set Cht = ActiveSheet.ChartObjects(PlotNo).Chart Series = Cht.SeriesCollection(...

VBA: How to match two sets?
In VBA for Excel (2007), is there an easy way to get a True result if *any* character in one set matches *any* characters in another set? If I understand the Like operator, the result is True only if *all* characters in the first set match a character in the second set. I would like to pass a string of debug parameters to a UDF. Each parameter is a single character, such as: "M" = Display a message "B" = Set a breakpoint "I" = Dump some info to the immediate window. I would like to pass these as a string that can include zero or more ...

Excel VBA
Hi VBAers, Rows are able to be created via a userform via a cmdAdd command button. My code to add rows works fine but I want to write extra code to make it check if row 29 has just been saved and then present a msgbox (stating not allowed to go any further) and ALSO not allow any further row additions (via the cmdAdd on userform). I don't know how to make it not allow any further. I suspect I need to set up variables like currentrow & check if currentrow is row 29 but I don't know how to go about it. Can someone please advise how to do this? If you can look at a single cell to...

Error using vba
I am new at VBA and trying to use VBA in powerPoint 2007 in a vista os to create a quiz. I am reading a set of question into an array of questions from a file and want to add one question at a time to a text box. I am using the following code: ActivePresentation.Slides(5).Shapes("TextBox 19").TextFrame.TextRange.Text = question(number) but I have been getting the following error: Run-time error '-2147188160 (80048240)': Item TextBox 19 not found in the Shapes collection. But when I check the object code using either the selection and visibility option in...

VBA: how to set a category to all mail in a folder ?
Hi everyone, I need to set automatically a category to alll email in a IMAP folder. (and for every new incoming email in this folder) I've found this code in VBA but it give a category only to the selected email when the macro is launch. Sub essai() Dim MonApply As Outlook.Application Dim Expl As Explorer Dim myNameSpace As NameSpace Dim myFolder As MAPIFolder Dim myItems As Items Dim xi As Integer 'object instance Set MonApply = Outlook.Application 'Application Outlook 'Expl is current folder Set Expl = ActiveExplorer ...

VBA to change format of a linked cell
I apologize if this is really simple, but I've been searching around on the web and haven't found what I am looking for.... Maybe I am not searching for the right thing..... I would like to know the VBA syntax that I could use to change the font format of a linked cell to be the same as the cell it is linked to... A simple example: on sheet2, in cell b13, is the value 2. It is colored blue and is bolded. on sheet2, in cell b47, is the value 5. it is formatted in the default manner cell A1, on the sheet named sheet1, contains the formula ='sheet2!b13' cell A2, on the sheet ...

How to format yyyymmdd with Button and VBA ??
I tried this... Sub Button8_Click() Sheets("Sheet1").Select Range("C10").Select ActiveCell.FormulaR1C1 = Now() ActiveCell.AutoFormat = yyyymmdd ' WRONG End Subf But the last line is not correct. I don't know how to code it. Can anybody help me out? thanks Sub Button8_Click() with worksheets("sheet1").range("c10") .value = now 'include the time, too??? ' .value = date 'if you want to avoid the time. .numberformat="yyyymmdd" end with End Sub You don't ...

Simple Range Syntax Question
Right now, I have the following line of code in a macro: Range("B6:B129").FormulaR1C1 = _ "=YEAR(RC[-1])&TEXT(MONTH(RC[-1]),""00"")&TEXT(DAY(RC[-1]),""00"")" Now I want to generalize the reference to select, starting in cell B6, a range that is X rows long and Y rows wide (X and Y determined elsewhere). How to I change this code? Thanks, John Range("B6").Resize(numRows, numCols).FormulaR1C1 =3D .... Tim On Nov 23, 5:50=A0pm, John V <jmven...@samford.edu> wrote: > Right now, I...

VBA recomendations
I'd like to learn VBA from the scratch so I could write some of my own codes instead of bothering you guys every time I need something new Don't misunderstand me, I really appreciate you help but I'd like to understand what you giving me and I'm ashamed to ask every time you give me a code how to read it so I could modify it if I need to So, do you have any suggestions where to start? maybe some web sites? books? whatever... Again, appreciate your help Mark Hi, Try: http://msdn.microsoft.com/office/downloads/vba/default.aspx You don't need to learn VBA... you'll kno...

2010 office beta
We are using some vb code to copy slides from one power point presentation to another. The code is working properly with the previous office versions (2007, XP etc). But, for office 2010 the code to paste slide to the destination presentation is not working. It shows an error message: "Run-time error '-2147417851 (80010105)': Method 'Paste' of object 'Slides' failed" Please find attached PowerPoint2010-Error.JPG also. Code used to copy and paste the slides is as follows: Dim oSource As Presentation Dim oTarget As ...

From VBA: How to select a column by column number instead of letter?
I'm in MS Access and don't know from column letters - all my constants are in terms of column number. I'd like to select, say, column number 7 and hide it.... ? -- PeteCresswell in a macro columns(7).hidden=true -- Don Guillett SalesAid Software donaldb@281.com "(Pete Cresswell)" <x@y.z> wrote in message news:i117011tjd8g1bimpn0dmk2oc1e901bbvn@4ax.com... > I'm in MS Access and don't know from column letters - all my constants are in > terms of column number. > > I'd like to select, say, column number 7 and hide it.... > > ? > -...

Open presentation in slideshow view, from Access via VBA
I've got an Access application I'm developing to control a Powerpoint presentation. I've figured out how to open PPT, select a presentation, and view that presentation in design view, but have not figured out how to switch the view to SlideShow. Assuming I have application (oPPT) and presentation (oPres) objects, what VBA do I need to change the view of PPT from design view to slideshow view. ---- Dale Hi dale Does oPres.SlideShowSettings.Run do it? -- john ATSIGN PPTAlchemy.co.uk Free PPT Hints, Tips and Tutorials http://www.pptalchemy.co.uk/powerp...

Syntax error!
I can't find out where should I put the semi colon... Thanks mySQL2 = "INSERT INTO Kanban ( PartNumber, K_Qty, K_Location, To_From, K_Date )" & _" VALUES ( '" & Me.txtPartNumber & "', " & strQuantity & " , '" & strLocation & "','LoanID " & Me.txtLoanID & "', '" & strDate & "')" & _" WHERE LoanID = '" & Me.txtLoanID & "'" -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx...

VBA insert a photo
I am inserting a photo into a worksheet and sizing it to a specific range when a name is chosen from a list validated cell. I am using the following code: ********************************* Dim RepPhoto As Picture Dim CurrentWorksheet As Worksheet Dim RepPhotoFileName As Variant Dim strFirstName As Variant Dim strLastName As Variant Set CurrentWorksheet = ActiveSheet 'Get the FIRST NAME of the full name stored in the cell H5 strFirstName = Trim(Right(Range("H5"), Len(Range("H5")) - InStr(1, Range("H5"), ",", vbTextCompar...

Saving VBA
How do I save User defined function that I create with VBA so that the are available in every new workbook that I ope ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com Guy, Save the workbook containing the functions as an Add-In. Then, go to the Tools menu, choose Add-Ins, and load your add-in. You can then call the function directly from a worksheet cell. -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Guy Wates...

VBA for Print and delete command
I want to delete data with the criteria of using "Year" and "Quarter" [OTDLTable] but before that happens. I would like a message box to appear asking "Do you want to print data before deletion. with a "Yes" or "No" buttons. If "Yes" display the criteria for query QTquery, open and print "QuarterReport" then delete said data. If "No" display message "Data will be deleted" . ...

VBA to FTP file....Grrr....
I have set up an Excel "program" that is sent out to clients. The enter an order into a specified sheet, and then they click a button t send the order to us. I have it set up to change the sheet into a CS txt file, and I've got it set up to send the order to us via e-mail. I'd like to have the "send" button, instead of sending the txt file vi e-mail, have it send directly to our ftp site to avoid potentially no receiving the order if the e-mail system or server is down. So, basically I'm hoping that (once again) I can beg for some synta that would send to ...

deleting users using VBA
Is it possible to delete users from the Access Workgroup file using VBA? I want to do a lot and the User and Group Accounts window in Access is very tedious, designed more for adding/deleting a few names at a time. Thanks in advance. I found this a while back. I hope it is what you're looking for. Public Sub DeleteUser(strUser As String) ' Delete a user ' Source: Graham R Seach - MS Access MVP ' http://groups.google.ca/group/microsoft.public.access.security/browse_thread/thread/3527785593af7279/b0d043a4d1dd6886 On Error Resume Next DBEngine(0).Users.Delete s...

RW_GetInternetInfo Proper Syntax
I'm trying to add several Company Internet Info (Web Site, email, UDF1 & UDF2)lines to the SOP document types and I'm struggling with the proper syntax. I've read through a few TK articles(i.e. Article ID : 859780 ), but I can't seem to figure it out. Most of the TK articles reference specific fields on the report, I need to reference the Company ID which is a Global field. I've tried the following, but it doesn't work: FUNCTION_SCRIPT(RW_GetInternetInfo"CMP" Company ID 2 ) My purpose for the above statement is to add SY01200.INET2 databas...