Posts by stildawn

    Hi All


    I think this will be a simple one, basically I have a code that checks some stuff, and I would like it to stop when it finds a problem with the data and select the cell so the user can do stuff.


    Range.Select works, the cell is selected, however if its way down the rows it wont show, the user still has to scroll down and find the selected cell, is there another command to add in so the screen also goes to the cell so that its immediately visible to the human eye?


    Thanks in advance.

    Hi All


    I have an invoice which I format using VBA, in this I have a .Find code that finds the header line so it can delete all the other crap.


    The issue I have is that the people who provide this for me keep changing the working in the header, so I was thinking, is there away to have a .Find code but have it check through mulitple possible strings?


    So something like this:


    .Find("FOB PRICE") or .Find("UNIT PRICE") or .Find("PRS") or .Find("TTL") etc etc


    So it goes through this list of key words looking for each one in turn? If it finds one then it stops there?


    Thanks in advance

    Re: Delete selection based on user selection


    Um working with this bit as I think this is what your asking:



    Change to this I think:



    Save a copy and test first cause this is a best guess from what you've told us.

    Re: Userform to select sheets in VBA


    Your right in the use of a userform, just go ahead and create the userform with three check boxes and a continue button.


    Then code something like this in your current code:


    Code
    Public SheetNum As Long


    Put this at the top to declare a public variable


    Code
    Userform1.Show


    Put this where you would like the user to make the sheet selection.



    In the Userform in the "Click" event code for the Continue Button put something like:



    This will then assign the checkedsheet number to the SheetNum variable, so you can use that later on it your code, like for example:


    Thisworkbook.Sheets(SheetNum).Range("A1") = "Hello"


    For example.


    Hope this helps.

    Hi All


    I am having issue with a 91 error, I have tried all the different versions I can think of but nothings working and I dont know why.


    Here is the full code of the userform:



    My issue currently is with the procedure Map_Change



    All I'm trying to get is the row number... But whatever I do it errors out, I think its something to do with the range part for find to search in.


    Any ideas?

    Re: I'm not closing off Excel properly I think?


    Yep cause in Access (and I believe any other program where you are working with automation with Excel) if you make a reference to an Excel element that isn't properly referenced back to the Excel object you created, Access will "start" a new hidden instance of Excel, which since its new and separate to your Excel object, its not closed off properly.


    This instance will be kept "running" as long as that instance of Access is open, it will close if you close Access, hence why second runs of the same code cause an issue, but first runs work.

    Re: I'm not closing off Excel properly I think?


    Oh wow.... That makes perfect sense damn it hahaha I was looking over and over it for the missing reference to the objExcel object, totally glossed over that.


    Let me test now.


    Excellent thanks a bunch for spotting that. That was the issue its all working now and closing off Excel in task manager also.

    Hi All


    Doing some VBA in Access and I have this code which basically opens and formats a Excel sheet then saves it ready for import:



    However I notice that Excel is still running in task manager after using this code, and if I run it again it will crash out, but if I end process in task manager, then run it, its fine.


    So I think I'm not ending excel in the code properly?


    Any ideas?


    Thanks

    Re: Updating the Access Table with a excel spread sheet


    In an update to this, ideally each time I do this update I would like it to also use the following code:



    This code works currently on forms, so that when you update a field it records each change in a separate "DataChanges" table.


    Ideally the daily updates from Excel would also populate the "DataChanges" table using this code? So perhaps is there away to do it through a form? Or code using this code?


    Thanks, Access is not my strong suit.

    Hi All


    I am just starting out on a new Access project.


    Basically what I have in Access is a table which lists jobs via their HB Number (as well as a ID number access gives them). For each job there is a bunch of details and some Yes/No fields.


    Each day I will get a dump from another system that will list jobs like this, I then need to "Update" the Access table with any new information from the excel dump. The update would need to:


    1. Insert new records (jobs) from Excel dump into Access Table
    2. Update any of the records fields (except HB of course as its unique) in the access table from the Excel dump (the Excel dump obviously wont have access ID numbers, but will have the HB)


    For a real basic example:


    Access Table Like So:


    [TABLE="width: 500"]

    [tr]


    [td]

    ID

    [/td]


    [td]

    HB

    [/td]


    [td]

    Finished

    [/td]


    [/tr]


    [tr]


    [td]

    1

    [/td]


    [td]

    5A

    [/td]


    [td]

    Yes

    [/td]


    [/tr]


    [tr]


    [td]

    2

    [/td]


    [td]

    5B

    [/td]


    [td]

    No

    [/td]


    [/tr]


    [tr]


    [td]

    3

    [/td]


    [td]

    5C

    [/td]


    [td]

    No

    [/td]


    [/tr]


    [tr]


    [td]

    4

    [/td]


    [td]

    5D

    [/td]


    [td]

    No

    [/td]


    [/tr]


    [/TABLE]



    Excel Dump looks like this:


    [TABLE="width: 500"]

    [tr]


    [td]

    HB

    [/td]


    [td]

    Finished

    [/td]


    [/tr]


    [tr]


    [td]

    5A

    [/td]


    [td]

    No

    [/td]


    [/tr]


    [tr]


    [td]

    5B

    [/td]


    [td]

    Yes

    [/td]


    [/tr]


    [tr]


    [td]

    5C

    [/td]


    [td]

    Yes

    [/td]


    [/tr]


    [tr]


    [td]

    5D

    [/td]


    [td]

    Yes

    [/td]


    [/tr]


    [tr]


    [td]

    5E

    [/td]


    [td]

    No

    [/td]


    [/tr]


    [/TABLE]


    So some Yes/No's are different and there is a new HB called "5E"


    After the "update" Access should look like this:


    [TABLE="width: 500"]

    [tr]


    [td]

    ID

    [/td]


    [td]

    HB

    [/td]


    [td]

    Finished

    [/td]


    [/tr]


    [tr]


    [td]

    1

    [/td]


    [td]

    5A

    [/td]


    [td]

    No

    [/td]


    [/tr]


    [tr]


    [td]

    2

    [/td]


    [td]

    5B

    [/td]


    [td]

    Yes

    [/td]


    [/tr]


    [tr]


    [td]

    3

    [/td]


    [td]

    5C

    [/td]


    [td]

    Yes

    [/td]


    [/tr]


    [tr]


    [td]

    4

    [/td]


    [td]

    5D

    [/td]


    [td]

    Yes

    [/td]


    [/tr]


    [tr]


    [td]

    5

    [/td]


    [td]

    5E

    [/td]


    [td]

    No

    [/td]


    [/tr]


    [/TABLE]



    This example is overly simple, the actually data has lots of different fields and many many many more records. But yeah basically need to update the table from an excel dump.


    Any ideas on how to do this? I thought it was as simple as doing a Excel Import > Append Table thing in Access, but that just seems to add the new records and ignore the updated fields?


    Thanks in advance


    Cheers


    Also posted here: http://www.mrexcel.com/forum/m…ad-sheet.html#post3790734

    Re: Find empty cells in column and auto input formula with certain criteria using VBA


    Like this:


    Re: Clearing contents of specific cells on different sheets within the same Workbook


    You should go through and remove all the .select lines and just merge the first parts of the .select lines with the last part of the following Selection. lines


    For example:


    Yours:

    Code
    Sheets("VO").Select
    Range("B19:D27").Select
    Selection.ClearContents


    Is better as:

    Code
    Sheets("VO").Range("B19:D27").ClearContents


    If its stopping on Sheets("Cutting").Select, the sheet of that name either doesnt exist or is hidden I believe

    Re: Creating folder beside the excel file :)


    It is a highly useful language to know, especially in any business/office type work position. I use it multiple times daily to automate just about everything I do. Its fairly easy to get the hang of also.