Posts by GhostMonkey72

    Re: Populate userform Labels with range form worksheet


    Quote from Logit;786304

    Please post your solution for others. It helps. Thanks !


    Here you go!


    Code
    1. Dim L As Long
    2. For L = 88 To 145
    3. ShiftChecker.Controls("Label" & L).Caption = ThisWorkbook.Sheets("Ranges").Range("B1216:B1273").Cells(L - 87, 1).Value
    4. Next

    Hi,


    Im trying to populate two columns of labels on a Userform (both 20 labels) with two columns from a worksheet but not having much success.


    Currently I have this,



    But I get an couldn't find the specified object run time error.


    Ive had a little success with,


    Code
    1. For L = 30 To 41
    2. For C = 1216 To 1227
    3. Controls("Label" & L).Caption = ThisWorkbook.Sheets("Ranges").Range("B1216").Value
    4. C = C + 1
    5. Next
    6. Next


    But this just populates the same number in each label.


    Anyone able to offer some help on where im going wrong?


    Many thanks in advance.

    Hi,


    I have 58 text boxes all of which can have a value from -32 to 40 and im trying to set a colour of the textbox dependant on its number,


    between -32 and -3 is one colour
    between -2 on 0 is another colour
    and
    between 1 and 40 is another colour.


    Ive tried using various bit of code but cant quite get anything to work.


    Has anyone got any insights to share?


    Thanks in advance


    The below code is the closest I have got,


    I have also posted this thread here http://www.excelforum.com/show…617&p=4427326#post4427326


    Re: Convert Excel Range to Word and then email as attachement


    Not at all, it was fine until the spec of what was required changed so had to make a few changes.


    Just thought I seem to keep asking you for advice so thought I would give you a break and try a different avenue.


    Hope there was no offence caused because it certainly wasn't intended.

    Hi,


    I can see that you can email a range from excel as an attachment or as part of the body of the email and I can see that you can convert the excel file to PDF and then email. But im wondering is it possible to take a range from excel place it into a word document and then email the word document as an attachment?


    Has anyone got any insight into if this is even possible let alone how you can do it?


    Thanks in advance

    Re: Populate Range of Cells on to Range of Userform Textboxes


    I thanks for the response,


    Yes if c is 2 and r is 10 then you would get cell B10.


    The columns which the information lies in are A,B,D,G,J,M,P,S,V,Y,AB,AE


    The 1st row will populate textboxes 1-12
    The 2nd row will populate textboxes 13-24
    The 3rd row will populate textboxes 25-36 etc...


    and yes there are 372 textboxes in total.


    The code im trying to adapt may not be the best choice so if you have a suggestion that may work better im happy to try it.

    Hi I have a spread sheet that has a grid with 31 rows and 12 columns and im trying to activate a userform which has the same amount of textboxes as there are cells in the range on the spread sheet and display the cell range into the textbox range.


    I can manually do this by using the following code,


    etc...


    But this coding is quite cumbersome (when I have all 31 rows listed) so im trying to reduce its size adapting this code,



    But I don't seem to be able to get this to work.


    Anyone point me in the right direction as to why?


    Any help is greatly appreciated.

    Re: Reducing large code


    Well it turned out not to be a solution more of a work around.


    Instead of just having 1 sub to populate the information I created 4 (just changed the reference points) and used a command button to pull the relevant information across to populate a single page userform.


    Works great for my needs as only one page at a time would ever be used.


    The code for each sub is pretty much what S O posted but just a couple of small differences so he must take the credit for it!! Will post it if anyone wants to see it.

    Re: Reducing large code


    That's great thanks for your help, think I may have another solution to it instead.


    You have shown how to combine the code and that is a huge help, so thanks again!!

    Hi I have a code I use to populate a userform and I believe there maybe a way to remove some of the code as it repeats quite a lot but im not sure how to do it.


    Here is part of the code as you will see there is a lot of textboxes that fill from cells on a worksheet.


    If anyone can give me a few pointers it would be greatly appreciated.


    Thanks