Posts by cytop

    Re: Code does not 'run' when assigned to a button


    Is there a reason why this may be occurring?

    Obviously there is, but there's not enough information in your post to say why.


    it fails to run in the same way and encounters errors

    You should expend that statement - what does it do, or not do, depending how you start it? What errors occur? (Probably 1004, though - but that's just as unhelpful).

    What type of button is it? ActiveX or Forms?
    What type of module contains the code? (Standard code module/Class module/worksheet class/userform)...?

    Re: Track new data

    I would doubt anyone could help with the information you have given. Please take the time to explain your process, what information changes, how, and what information you want to track.

    Ideally upload a sample workbook showing a before and after scenario.


    Re: How to auto replace text in a formula

    For simplicity, I edited the formula in B10 to prepend 'NPS' to the start of the formatted date. You could include it directly in the main formula but then you'll be using multiple quotes marks to delimit the literal string and they're confusing enough on their own...
    [bfn]="NPS" &TEXT(B9,"ddmm")[/bfn]

    Your main formula then becomes
    [bfn]=VLOOKUP(K6,INDIRECT($B$10 &"!A:B"),2,FALSE)[/bfn]

    Obviously you need to make those references Absolute/Relative depending...

    Re: Creating multiple Outlook calendar items - with attachment or link

    Not easy to answer as there's no details as to how you create the calendar entries.

    If you were using VBA to create appointment then adding an attachment is as easy as (assuming there's an Appointment object named 'Appt')

    Appt.Attachments.Add "C:\"

    I would guess you're just importing the CSV but am not sure of a way to include attachments/hyperlinks in that, unfortunately.

    After a little test, it may not be possible. I added a Calendar item with an attachment and then exported that. Even when all the (available) fields to export were selected, the attachment didn't show in the exported CSV file.

    Re: Code Error When run via a Click button


    how would you run a Find, to replace the Do Loop

    Something like this. Have also used looping an array to read the various offsets and all worksheet references are qualified so it should not matter what is activated when the data is copied/pasted (But do not know how you defined 'Cell' - check that)

    Obviously this was done outside the context of your workbook so if you want to test it, use a copy - I cannot know the exact structure/layout so is an example only.

    EDIT: Just seen the expanded code in post #1.

    Would strongly suggest that setting the references to the Range variables be changed.

    Set rng = ActiveWorkbook.Sheets("Selection").Range("N2:N11") 
    Dim FRng As Range 
    Set FRng = ActiveWorkbook.Sheets("Selection").Range("AA2:AE11")

    Try to avoid the use of ActiveWorkbook and ActiveSheet. These are rather vague and really should only be used when you are 100% certain the Active workbook/sheet is actually the one you want to refer to.

    Instead of ActiveWorkbook use ThisWorkbook to refer to the workbook the code is running in, or explicitly name the workbook you want to refer to.

    Instead of ActiveSheet, use the sheet name and, preferably, the sheet CodeName as this cannot be changed by the user outside the VBA development environment.

    Re: Inventory totals


    ...posted this in another thread...

    That's actually a 'template' - to insert the (formatted) text just type


    (SW = Sample Workbook as a mnemonic)

    You won't see anything while typing the message but the template text will be inserted when you post the message.

    Re: Excel to Word Conversion

    What you are asking is possible and can be done either in Word or Excel (or Outlook if you prefer), however you are rather light on details.

    I've no idea what you mean by 'Stand-alone' macros. All VBA macros are hosted in the containing application (Excel, word, Outlook, Access or whatever).

    You can have radio buttons on an Excel worksheet or userform, a Word document or userform and the same for Access.


    but getting off the ground with some kind of starting point is difficult

    If it's difficult for you, then it's more difficult for us based on the information in your post. You need to explain the data, any predefined text, the purpose of the 'radio buttons' (to select/hide sentences/paragraphs, for example), the scope of any freehand typing by the user and things like that.

    You know what your desired end result is - you've got to communicate that to others

    Re: Clear and restore conditional formatting of different cells before printing

    You can't edit after a certain time - but you could have added a reply saying you had reposted with a link to the new post. I'll close that thread.

    As requested, please add links to your posts on other forums for this issue. You agreed to do that if you posted the same issue on multiple forums, when you joined here.

    Re: Skip Formula Columns in Sheet when Userform active for editing entries

    If the texboxes are locked, then I would have thought

    For j = 2 To 38 
                        If DataEditUserForm.Controls("TextBox" & j).Locked = False then 
                            Cells(i + 5, j).Value = DataEditUserForm.Controls("TextBox" & j).Value 
                        End If
                    Next j

    Would have skipped those textboxes which are locked when updating the worksheet...

    But, like I said, I don't really understand what you're trying to do and pictures are useless to illustrate a problem like this. Really need a copy of the workbook.

    Re: Macro / Formula to automatically update changes into database based on user-input

    It is not clear as to what you want to update.

    The following code will update the table on the Sheet 'Updated Data' when valid data is entered into B13:D13. 'Valid data' means the Code already exists in the range B32:B41 and the date already exists somewhere on Row 31. The cell intersecting that Row/Column will be updated with the employee name.

    This only works for the range B13:D13 and it will be cleared after the table has been successfully updated.

    The code should be placed in the code module for the worksheet 'Updated Data'

    Re: Skip Formula Columns in Sheet when Userform active for editing entries

    Using a phone, so comments only, and I may not have understood correctly but you could try setting the Locked property of those textboxes containing formula results to True. That'll prevent the user changing those .

    Then, when writing back to the worksheet check if a textbox is locked before writing its value to the worksheet.

    Re: Auto move the entire row if the date fall between certain date

    Sorry, it's not at all clear what you want.

    Yes, you can list movies that are showing in August and September no problem but that will only for those specific dates - what happens in October, November and later?

    Perhaps if you try to explain how this is used. Is it to list scheduled showings for the current and previous month? It is an input sheet where the user types in the film name & showing dates and it is then moved to the correct period...?

    Re: Build parent/child hierarchy

    The wrong sample data confused things a bit so I had to discard some code but it seems you have replies in the other threads, so am taking the easy way out.

    Re: Build parent/child hierarchy

    The duplicate pairs (AB00002 & AB00005) plus AB00007 being a child of both AB00002 & AB00003 makes it difficult to devise an accurate solution in code. Please explain the logic behind the groupings.

    Re: Display/Show Column Headings In ListBox


    adding in my code something i can show header column

    That was answered (in the context of an Excel environment) in my first reply. I can't imagine VBA based controls, if available in the environment you use, will have any extra functionality to that provided in Excel.

    I can't comment about other controls native to your environment, so sorry, I can't help further.