Search Results

Search found 1188 results on 48 pages for 'vba to c'.

Page 6/48 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • VBA Worsheet.OnActivate

    - by Rashmi Pandit
    Hi, I have a method in my VBA code that needs to be assigned to a workbook How can I assign this method to the worksheet.OnActivate event using VBA code? I tried: sht.Onactivate = "Sheet_Activate" But this doesn't work and I need something on these lines. Thanks.

    Read the article

  • Count number of arguments to Excel formula in VBA

    - by Abiel
    I need to use VBA to determine the number of arguments passed to an Excel formula. For instance, suppose a cell contains the formula =MyFunc($A$1, "xyz", SUM(1,2,COUNT(C1:C12)), IF(B12,1,0)). Then the counter function should return 4. Does VBA contain any built-in functions for this, or does someone have an example of a regular expression that could calculate this?

    Read the article

  • Basic script for VBA

    - by rmdussa
    Hi I need basic script for excel and VBA. for example on sheet1 have table col1(name), col2(netsal),col3(bonus) in sheet1 need a button and want to click that button to get results in sheet2 needs to be col1(name),col2(netsal),col3(bonus), col4(col2+clo3)(total sal) could you please give steps to follow and VBA scripts Thanks

    Read the article

  • VBA Or .Net Framework?

    - by hosseinsinohe
    Hi All I Want Develop And Automat Office Softwares like 'Microsoft Excel 2007' And 'Microsoft Word 2007' .But I do not know Use VBA or Use C Sharp Language And .Net Framework to do this? What is the Benefits of Use VBA or Use .Net Framework? Which One Is Better To Learning And Focus?

    Read the article

  • VBA Or .NET for working with Office?

    - by hosseinsinohe
    Hi All I want to develop and automate Office software like 'Microsoft Excel 2007' And 'Microsoft Word 2007'. But I do not know how to use VBA or use C#/.Net Framework to do so. What are the benefits of using VBA vs .Net framework? Which one should I focus on learning?

    Read the article

  • Using Excel as front end to Access database (with VBA)

    - by Alex
    I am building a small application for a friend and they'd like to be able to use Excel as the front end. (the UI will basically be userforms in Excel). They have a bunch of data in Excel that they would like to be able to query but I do not want to use excel as a database as I don't think it is fit for that purpose and am considering using Access. [BTW, I know Access has its shortcomings but there is zero budget available and Access already on friend's PC] To summarise, I am considering dumping a bunch of data into Access and then using Excel as a front end to query the database and display results in a userform style environment. Questions: How easy is it to link to Access from Excel using ADO / DAO? Is it quite limited in terms of functionality or can I get creative? Do I pay a performance penalty (vs.using forms in Access as the UI)? Assuming that the database will always be updated using ADO / DAO commands from within Excel VBA, does that mean I can have multiple Excel users using that one single Access database and not run into any concurrency issues etc.? Any other things I should be aware of? I have strong Excel VBA skills and think I can overcome Access VBA quite quickly but never really done Excel / Access link before. I could shoehorn the data into Excel and use as a quasi-database but that just seems more pain than it is worth (and not a robust long term solution) Any advice appreciated. Alex

    Read the article

  • Copy recordset data into multiple sheets to avoid problem of maximum rows limit in Excel VBA

    - by Sam
    I am developing reporting application in Excel/vba 2003. VBA code sends search query to database and gets the data through recordset. It will then be copied to one of excel sheet. The rertrieved data looks like as shown below. ProductID--|---DateProcessed--|----State----- 1................|.. 1/1/2010..............|.....Picked Up 1................|.. 1/1/2010..............|.....Forward To Approver 1................|.. 1/2/2010..............|.....Approver Picked Up 1................|.. 1/3/2010..............|.....Approval Completed 2................|.. 1/1/2010..............|.....Picked Up 3................|.. 1/2/2010..............|.....Picked Up 3................|.. 1/2/2010..............|.....Forward To Approver The problem is data retrieved from search query is so huge that it goes above the excel row limit (65536 rows in excel 2003). So I want to split this data into two excel sheets. While spliting the data I want to ensure that the data for same product shoud remain in one sheet. For example, if the last record in the above result set is 65537th record then I also want to move all records for product 3 into new sheet. So sheet1 will contain records for product id 1 and 2 with total records = 65534. Sheet 2 will cotain records for product id 3 - with total records = 2. How can I acheive this in vba? If it is not possible, is there any alternative solution ? Thanks in Advance !

    Read the article

  • Excel VBA (2007) Subtotal method of Range class failed

    - by robihot
    Hi, I'm getting a Subtotal method of Range class failed Error when i try to run a macro. Code works GREAT (no errors) when i run it using Excel 2003. Here's a snippet... 'SubTotal Sheet Range("A1").Select Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4, 5, 6, 7, _ 8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True Any help would be appreciated !!!

    Read the article

  • Outlook VBA script - find and replace text with image

    - by user2530616
    I have a e-commerce store. When I get a sale, I receive an order confirmation email which contains the name of the product sold. When the email comes through, I would like to run a script that replaces the product name eg. "red widget", with a picture of that product. Is that possible? I have found a similar code to replace text (set of numbers in this case) with a link, but I need it to replace with a picture instead. Option Explicit Sub InsertHyperLink(MyMail As MailItem) Dim body As String, re As Object, match As Variant body = MyMail.body Set re = CreateObject("vbscript.regexp") re.Pattern = "#[0-9][0-9][0-9][0-9][0-9][0-9]" For Each match In re.Execute(body) body = Replace(body, match.Value, "http://example.com/bug.html?id=" & Right(match.Value, 6), 1, -1, vbTextCompare) Next MyMail.body = body MyMail.Save End Sub example mail Order Confirmation Thanks for shopping with us today! ------------------------------------------------------ Order Number: 2209 Date Ordered: Friday 28 June, 2013 Products ------------------------------------------------------ 1 x red widget = $5.00 ------------------------------------------------------ Total: $0.00 Delivery Address xxx search text: "red widget" replace picture: redwidget.jpg

    Read the article

  • 'Object variable or With block variable not set' error when setting a range in VBA

    - by David Gard
    I have a function that creates a Pivot Table, but I am getting an error when I try to set a range that will be merged and have a title added to it. In the below code, pivot_title_range is a 'String' variable, and is optional when calling the funtion. title_range is a 'Range' variable. Both lines that set the range (whether or not the users declares pivot_title_range) cause the same error. If pivot_title_range = "" Then title_range = ActiveSheet.Range("B3:E4") Else title_range = ActiveSheet.Range(pivot_title_range) End If Here is the error that I am getting - Run-time error '91': Object variable or With block variable not set If required, here is a Pastebin of the full function - http://pastebin.com/L711jayc. The offending code starts on line 160. Is anybody able to tell me what I am doing wrong? Thanks.

    Read the article

  • Macro is not Cooperating with Quotations in Excel VBA

    - by B-Ballerl
    I Have a macro containing a line that will change the formula of a cell using R1C1 formula type. The formula is: ActiveCell.FormulaR1C1 = _ "=IF(R[0]C[-2]=0,"",(R[0]C[-20]-R[0]C[-16]))" When ever I attempt to run the macro it always comes up with a dialog box saying Run-time error '1004': Application-defined or object-defined error. And when you click debug it highlights those 2 lines in the macro. And I can't figure out how to fix it. Can anyone help?

    Read the article

  • Excel VBA (2007) Subtotal method of Range class failed

    - by robihot
    I'm getting a Subtotal method of Range class failed Error when I try to run a macro in Excel 2007. Code works GREAT (no errors) when I run it using Excel 2003. Here's a snippet... 'SubTotal Sheet Range("A1").Select Selection.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(3, 4, 5, 6, 7, _ 8, 9), Replace:=True, PageBreaks:=False, SummaryBelowData:=True Any help would be appreciated.

    Read the article

  • Excel VBA Function runtime error 1004: Application-defined or object-defined error

    - by music2myear
    I'm trying to learn functions for the purpose of simplifying and reusing code whenever necessary. I began by turning something I use pretty often into a function: Returning the integer value of the last non-blank row in a spreadsheet. Function FindLastDataLine(strColName As String) As Long FindLastDataLine = Range(strColName).Offset(Rows.Count - 1, 0).End(xlUp).Row End Function Sub PracticeMacro() intItemCount = FindLastDataLine("A:A") MsgBox ("There are " & intItemCount & " rows of data in column A.") End Sub When I run this I recieve the runtime error '1004' "Application-defined or object-defined error" which Help helpfully defines as "someone else's fault" to quote not quite verbatim. Where might I be going wrong?

    Read the article

  • Excel 2010 VBA on-start macro execution - Error

    - by Noob Doob
    I have been trying to create a macro to be executed every time I open the document. I tried to use the Open event, but it does not seem to be working. The code is below: Private Sub Workbook_Open() Cells(3, 1) = "WOWWW" End Sub (It might seem ridiculous but I am trying to make any chunk of code to work, to move further with the start-time macro). Each time I open the file, the cell (A3) does not seem to be changing. Any ideas on this? I don't know if it matters, but I don't open the file directly. I open it through opening the Excel program and then File Tab - Open - File. That is because I have a problem if I open the file directly, which is another matter.

    Read the article

  • Format Change Event for Excel VBA

    - by The_Third
    I'm trying to prevent people from modifying (most) of my spreadsheet while still alowing them to use the sort function of the AutoFilter. What I've done so far is used the Worksheet_Change event and Application.Undo to automatically undo any values entered into cells that I don't want to be modified. This works great, except that it can't detect changes in formatting. Does anyone know of a means to trigger an event when the format (text/background color) of a cell is changed? Thanks!

    Read the article

  • Excel Single column into rows, VBA script insight

    - by Sanityvoid
    Okay, so much similiar to the below link but mine is a bit different. Paginate Rows into Columns in Excel I have a lot of data in column A, I want to take every 14 to 15 rows and make them a new row with multiple columns. I'm trying to get it into a format where SQL can intake the data. I figured the best way was to get them into rows then make a CSV with the data. So it would like like below: (wow, the format totally didn't stick when posting) column A column B C D etc 1 1 2 3 x 2 16 17 a b 3 x y z 15 16 17 a b c I can clarify if needed, but I'm stumped on how to get the data out of the single column with so many rows in the column. Thanks for the help!!!

    Read the article

  • VBA code to hide or unhide rows based on a cell value

    - by I AM L
    Heres my code, but its not really doing anything, I dont see anything wrong with it: Private Sub PG1(ByVal Target As Range) If .Range("E50").Value = "Passed" Then Rows("51").EntireRow.Hidden = True End If ElseIf Range("E50").Value = "Failed" Then Rows("51").EntireRow.Hidden = True End If End Sub My intention is that when that specific cell in the previous row is set to "Passed" from the dropdown, then the below row would appear, if its a 'Failed" then it'll be hidden instead.

    Read the article

  • Create a custom worksheet function in Excel VBA

    - by Tomalak
    I have a faint memory of being able to use VBA functions to calculate values in Excel, like this (as the cell formula): =MyCustomFunction(A3) Can this be done? EDIT: This is my VBA function signature: Public Function MyCustomFunction(str As String) As String The function sits in the ThisWorkbook module. If I try to use it in the worksheet as shown above, I get the #NAME? error. Solution (Thanks, codeape): The function is not accessible when it is defined ThisWorkbook module. It must be in a "proper" module, one that has been added manually to the workbook.

    Read the article

  • Adding references from VBA Causing Password Prompt To Appear

    - by ChloeRadshaw
    EDIT: I WILL GIVE A 300 rep BOUNTY FOR THIS:-) I have run out of ideas. I have a very simple macro that adds references. It looks like I have the same problem as this http://www.eggheadcafe.com/software/aspnet/35651964/excel-prompts-for-vba-pas.aspx Sub testAddSolver() Call AddSolver() End Sub Sub AddSolver() Dim strSolverPath As String Dim wbSolver As Workbook Dim objRef As Object Dim oWB As Object ' NOT as workbook Dim ad As AddIn On Error GoTo errH Set oWB = ActiveWorkbook With Application.AddIns("Solver Add-In") strSolverPath = .FullName On Error Resume Next Set wbSolver = Workbooks(.name) On Error GoTo errH If wbSolver Is Nothing Then .Installed = True End If End With On Error Resume Next Set objRef = oWB.VBProject.References("SOLVER") On Error GoTo errH If objRef Is Nothing Then Call MsgBox(strSolverPath) oWB.VBProject.References.AddFromFile strSolverPath End If Call MsgBox("Compleetd") Exit Sub errH: MsgBox Err.Description, , "Error in AddSolver" End Sub This adding references works fine until I put a password around the VBA at which point it prompts me for a password. I have tried absolutely everything

    Read the article

  • Invoke a COM addin option from VBA

    - by rip
    Can I invoke an option on a COM Add-in from a VBA macro in Word or Excel 2007? The COM Add-in was written using VSTO – it adds a custom ribbon tab with a number of options that I want to execute from a VBA macro. I can reference the add-in using Application.COMAddIns("MyAddinName") but I can’t find an option to invoke an option. I’ve also played around with the Application.CommandBars collection, and can see that you can execute an option using CommandBarControl.Execute but I can’t find my command bar in the Application.CommandBars collection. Does anyone know if this is possible?

    Read the article

  • Can't see drop down list in Excel VBA

    - by Ten Ton Gorilla
    I've created a very simple drop down list in excel. It holds a sequence of integers loaded from a cell range (years). I need to read the selected value in vba. However I can't even seem to find the control! I've tried CboYear Sheet2.CboYear Worksheets("SheetName").CboYear etc. etc. From everywhere in VBA this control just doesn't exist. All the tutorial I find seem to assume that using just the control name will work. I've tried the code in the sheet itself, the workbook, and a module, no luck.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >