Posts by jamesparker_1

    Hi


    I want to make a hidden sheet visible. Except that i want to use the name of the sheet (the thing that stays the same even when you change the sheet tab name). I also want to select the name based on a variable called Year which the user adds elsewhere (eg as 2006).


    Code
    wf = "WF_Edin_" + Year    'So for 2006 this would read WF_Edin_2008
    wf.Visible = True


    The above doesnt work as wf becomes a string which i dont think i want do i?


    Thanks


    James

    Hi


    The below Vba code runs a mailmerge of data stored in an excel called "mailmerge.xls" fine. However, When it does run word always asks me to chose which sheet I want to mailmerge which is a bit annoying when i want the process to be fully automatic.




    What line of code do i need to add to make the macro automatically mailmerge "sheet1" of mailmerge.xls?


    Thanks in advance for your help!


    James


    (p.s. I put this problem in the 'Word' help section originally but maybe this is more a VBA/Excel issue):confused:

    Hi


    I have an excel worksheet called 'Data' and a graphsheet called 'Control'. The graph sheet doesnt contain a graph, I just use it as a blank sheet and put buttons on it that have macros attached (so it basically looks like a control panel).


    My problem is that on this control Panel, I want to have a little picture box or something that shows a uptodate picture of a summary section (Cells A1:H8) on the sheet 'Data'.


    Is there anyway to do this?


    If it helps. I've attched a copy of what i'm trying to achieve


    Thanks

    Hi


    I have two combo boxes: One for entering the Year, and one for the month. I can produce a message if the user leaves either box blank but I want a message to apear it the user selects a year AND month less than the current year (iYear) and current month (iMonth). I therefore need an AND statement between the two criteria but i dont know how to do it. Please help!


    Code
    '....First Checks the Comboboxes arent blank then below Checks a future month/year secection is chosen
    
    
    ElseIf YearBox.Value = iYear [COLOR="Red"]&[/COLOR] iMonthbox < iMonth Then
         MsgBox ("You may not enter Data before the current Month")
    Else     '...... Run main code here



    Thanks


    James

    Re: Range Definition Error


    Apologies, I had copied the code in wrong! :confused: Ive corrected that now and I have no bugging errors now. But no data value (Seating_BAU_Existing) is being put in cell d.Offset(2, 0) now which i cant understand!! :crying:

    Re: Range Definition Error


    Hi Andy


    I Really Appreciate all this help!!!


    I'm still getting told "Run-time erroe '1004' Application-defined or Object-defined error" but now at the point:


    Code
    With .Range(C.Offset(3, 0), C.Offset(3, 0).End(xlRight))


    James

    Re: Range Definition Error


    Hi


    I think i follow what is going on. I like the simplification of the code. But my macro still errors at the 'Set C = rngSearch.....' line. saying "Run-time error 424. Oject required". I'm only just getting to grips with this object stuff so what is wrong?


    Thanks

    Re: Range Definition Error


    I'm still getting told "Run-time erroe '1004' Application-defined or Object-defined error" at the same point.


    Is this anything to do with the fact that i define firstaddress1 as:


    Code
    firstaddress1 = C.Offset(3, 0).Address


    For Reference, here is the full code i'm using:


    Hi


    I get an error when I run this macro at the the first line in the code below. firstaddress1 is set to cell $H$7 and I want the range to go from the value of firstaddress1 to whatever the value of the column is containing the last data value.


    Code
    With Worksheets("Edin Capacity").Range(firstaddress1.End(xlRight)) 
           
            Set d = .Find(Seating_Month, LookIn:=xlValues)
            secondaddress = d.Offset(2, 0).Address
            
            Range(secondaddress).Value = Seating_BAU_Existing
    
    
    End With


    Thanks for your Help


    James

    Hi


    I have designed a userform where a user enters a year, a month and a value. I am trying now to make my macro search for this year along row 1 in my worksheet("Edin Capacity"), then once it has found the year, search through the months (Row 3) to find the month and then enter the value a couple lines down (Row 6). (I've attached an example sheet to make it clear).


    I've been looking at the excel help file and trying to modify it below but all i can do is search for the year that was entered (Public Seating_Year) and change the year to the data value. Not very impressive i know!



    Hopefully someone can help!

    Hi


    I've Created a userform with a ComboBox that I've filled with the 12 months of the Year as follows:


    Code
    Private Sub YearBox_Change()
    YearBox.Style = fmStyleDropDownList
    For i = 6 To 15
        YearBox.AddItem Format(DateSerial(i, 1, 1), "yyyy")
    Next i
    End Sub


    However. When i run the userform the combobox is always blank until i type something in it and only then can i see the dropdown list of months.


    I'm sure this is something simple! Can anybody help?

    Hi


    Hopefully a simple problem


    My excel workbook called "Main" has a macro that opens a new workbook fills the new sheet with addresses from a sheet in "Main" then Saves the new workbook as "Mailmerge.xls". It then loads a word file and automatically runs through mailmerging these addresses to the printer.


    My main problem is that I then write the below code to close the mailmerge.xls file:


    Code
    Windows("Mailmerge.xls").Close


    This is sometime ok the first time i run the process But I usually then get a window appear saying the following if i do it a second time:


    "Mailmerge.xls is now available for editing.


    Choose Read-Write to open it for editing."


    I dont want this to appear. I just want to close the file (I dont care if it saves changes or not if that helps).


    Any Suggestions?


    Finally Would this same code be used to close the word template documents used to mailmerge the data?

    Re: Macro to open Word and Start Mail Merge


    Hi Everyone


    I need some help with the problem of running a mailmerge from excel as you've described above. The Vba code runs a mailmerge of data stored in an excel called "mailmerge.xls" fine. However, When it does run it always asks me to chose which sheet I want to mailmerge which is a bit annoying when i want the process to be fully automatic.



    What line of code do i need to add to make the macro automatically mailmerge "sheet1" of mailmerge.xls?


    Thanks in advance for your help!


    James