Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update a range reference change
I have a user form that pops up and the user selects various things and
then hits a save button to record all the selections made to a worksheet. I then set a worksheet range to that row where the data was just entered. My problem is that this new range area does not seem to be updated and available when it gets set. I have a print button on the user form that hides the initial form and displays a worksheet. The work sheet uses formulas like: =INDEX(Print_Range,1,8) to get cell values from this print range that was supposedly just defined. I put several msgboxes in my code to see what the range("Print_Range").Name is set to and it comes back with the correct range but when my worksheet is shown the "Print_Range" range has not been updated to the new row. The bizarr thing is that when I rerun the user form and genereate a new line of info and set the "Print_Range" to this new line it all works fine. The Print button on my user for runs the same code again for a second time and all is well. Is there something that I have to refresh or recalculate on the worksheet that will make it accept this new range reference? Or is there something with just hiding the user form and not unloading it for this range change to take effect. THanks Scott |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update a range reference change
Here is the first part of the code from my print button that sets this
new print range. I also tested and found my search user form that searches for a line on the worksheet does not work correctly the very first time I run it. I run it a second time and it works fine. ??????????????? Private Sub CommandButton3_Click() Dim Rng As Range Dim Record Record = "RFQ" & UserForm1.TextBox7.Value & UserForm1.TextBox8.Value Set Rng = Sheets("Master log").Range("Unique_Identifier").Find(what:=Record , LookAt:=xlWhole, LookIn:=xlFormulas, SearchDirection:=xlNext, MatchCase:=False) 'Load the new RFQ info onto Email page ActiveWorkbook.Names.Add Name:="Print_Range", RefersToR1C1:="='Master log'!R" & Rng.Row .. .. .. End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update a range reference change
I figured out what was happening. I showed the userform from the
on_open sub of the workbook and on the line after I showed the userform was the line where I blanked out my range reference. I moved this line above showing the user form and now it resets my print range, opens the user form and lets the user form redefine the print range. I thought I was going crazy for a bit but after some very close step by step investigation (and a few days away from it) it all was clear to me. Scott |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Possible to change/update values in range of cells by X% ? | Excel Discussion (Misc queries) | |||
Shortcut to change change cell reference to Absolute reference? | Excel Worksheet Functions | |||
Dynamic range where the reference cell can change | Excel Discussion (Misc queries) | |||
change change cell reference to Absolute reference | Excel Discussion (Misc queries) | |||
Update date field upon cell range change | Excel Worksheet Functions |