Posts by David412

    Re: Runtime Error1004: Pivot Tables

    I can't believe I missed that... I manually changed the range to refer to Columns A to C in line 2 below--->

    ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
        "Sheet13!A:C").CreatePivotTable TableDestination:="", TableName:= _

    Funny thing is, when I record the Macro; even though I select the columns A:C, it still records it as C1:C3. :p

    I've learned my lesson. Thank you v. much.:smile:

    I recorded the following code using the 'Record Macro' option. The macro does not work properly when I run it and I receive the following error message:
    Runtime Error: '1004' Unable to get the PivotFields property of PivotTable class

    The macro only pulls in the PivotFiled- 'Result' into the [pt]*[/pt] dialog box, it gives me an error when it tries to pull the 'Part#' and 'Date' fields.

    Thanks in advance

    Re: Creating a new workbook from an xls file that is continuously updated


    This program that creates the .csv file. Does it append new values to an existing file? Or for each test does it create a brand new file?
    Say you are creating a test on moday, the first test you ever carryout will be appended in a new file created for that day. So, the first test will be the first row in that new file. Every test on that day will be in that file. Each test is sequenced by time.

    What exactly are you wanting?
    A VBA code that will automatically read any new row/test data inserted in a file (which is any new test) and then create, copy to and save ] to a new workbook . If also possible, read any new .csv file created in directory and carry out the same procedure.

    I kind of got the logic on how the process might work. Its just putting it to codes that's bugging me. And yes there is only one file created per day.


    Hello world:

    There is a program (I cannot access...) that creates a .CSV (Comma separated...) based on results acquired from a test. Separate file is crated for each day a test is performed. And each file will have only 1 sheet with data on it and that sheet will have Separate rows for each Test.

    I am trying to create VBA codes that will:

    1. Read each entry (each time a test is performed)
    2. Create a new workbook or file (name it the same as the new entry)
    3. Save that new file and display it for the user.

    Note: There is a new file created for each day, but all of the entries have dates in them.There are more steps after step 3 but I pretty much got those. Please i would really appreaciate any ideas.

    Here is what the entries look like, each row goes all the way to EK...

    (8/2/2005 10:47) ( 19.6 ) (CS130 ) ( Fail ) ( Diode Pos 1)



    Re: Searching through a worksheet for text or value entered in a text box

    Hey Helmekki:

    Are you asking how to use AND or OR, to refer to two components on a userform? Like say you have two text boxes and you want to display a Msgbox if a user does not enter values in one, the other or both of the textboxes you can use the following code.

    If TypeTxt.Text = "" Or SearchTxt.Text = "" Then
            MsgBox "Please enter Type value and/or search value Number.", vbOKOnly, "Error"
      End if

    If you are looking for other websites you want to look at....send me an email i will write you back ([email protected])


    Re: Searching through a worksheet for text or value entered in a text box

    Thanks guys its 90% functional now.... I used the following posted by rbrhodes. One tiny problem i am having is making it search for characters in a cell/worksheet. Say if i search of the letter A in my worksheet it should find that letter whether its by itself or with other characters like the A in Apple. It should display texts within cells that contain that character.

    Is this making sense?


    Private Sub FindCmd_Click()
    Dim Rng1 As Range, c As Range


    If SearchTxt.Text = "" Then
    MsgBox "Please enter Vendor Number.", vbOKOnly, "Error"

    Set Rng1 = Range("A1:F10000")
    With Rng1
    Set c = .Find(what:=SearchTxt.Text, LookAt:=xlWhole, _
    LookIn:=xlValues, SearchDirection:=xlNext)
    If c Is Nothing Then
    MsgBox "Cannot Find " & SearchTxt.Text & ".", vbOKOnly, "Sorry"
    UserFrm.Listtxt.AddItem c.Value
    found1 = c.Address
    End If
    End With

    Do While found1 <> foundx
    UserFrm.Listtxt.AddItem c.Value
    foundx = ActiveCell.Address
    End If
    End Sub

    Re: Searching through a worksheet for text or value entered in a text box

    Well, i made the changes but it still back to square one where it finds the first text or value and stops. It does not go to the next similar value within the worksheet.

    I am trying to create a program with a close to similar function as a regular search in excel. You do Ctrl+F, put in what you want to look for and it goes through the work sheet displaying any value or text (displaying it again-if it exists anywhere else).

    Thanks again for the reply...

    David :)

    Re: Searching through a worksheet for text or value entered in a text box

    Thanks for the superfast reply

    I tried the code you posted but its not working (nothing happens). Plus, if somehow the active cell in excel is changed say from A1 to B1, when you click on the find commandbutton it selects the entire range and does not search for anything...: hence

    Is there another safe haven for this?


    I am trying to search through an excel worksheet using the code below. I have a [highlight]Form[/highlight] containg a text boxes and a command button (SearchTxt, FindCmd). The VBA program is able to search through XL but (1) It does not set the next value or text in a the worksheet active
    (2) It only finds a value or text as an entire cell and not as a set of characters in a cell.

    I tried to use Cells.Find method that solves the above problems, but i get an error message-[highlight]Object variable not set (91) [/highlight].

    I would trully appreciate someones assitance...


    Private Sub FindCmd_Click()
    Dim Rng1 As Variant

    If SearchTxt.Text = "" Then
    MsgBox "Please enter Vendor Number.", vbOKOnly, "Error"
    End If

    Set Rng1 = Range("A1:F10000").Find(what:=SearchTxt.Text, Lookat:=xlWhole, _
    LookIn:=xlValues, SearchDirection:=xlNext)
    If Rng1 Is Nothing Then
    MsgBox "Cannot Find" & " " & SearchTxt.Text & ".", vbOKOnly, "Sorry"

    Exit Sub
    End If
    End Sub