Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Dyn Named Range update from userform

Hi All:

Some help here would be great. I am falling a little short on the
nuances of procedures that include dynamic named range.

I have a fairly large multipage userform that validates entries,
calculates some risk metrics and puts all data (input and output) into
an output worksheet. The output worksheet has a combobox
(cbodynEditEntry) that allows the user to edit a particular row.
cbodynEditEntry has a listfillrange that is a dynamic named range
representing the first column (rangename=dynProjectTitle).

The problem is not in running a new project through the userform, but
in editing an existing. My logic was to, upon selection of existing
project (either in userform or output sheet), find row with same
project title, delete that row, and repopulate with the modified data
stored in the userform. When I do this, the first column does not
delete and update. It only deletes. This then messes up
cbodynEditEntry. Some sample code follows. Thanks much and hope to
return the favor.

------------------------------------------------------------------------------------------------------------------
Private Sub Run_Click
Dim title as Range
Application.ScreenUpdating = False
On Error Resume Next

'''Find matching project title in row and delete row
Sheets("OutputData").Select
Set title = Range("dynProjectTitle")._
Find(cboProjectTitle.Value)
title.Select
ActiveCell.EntireRow.Delete shift:=xlShiftUp

'''Populate from userform ***The A procedure does not work. B works
fine.***
Worksheets("OutputData").Range("A65536")._
End(xlUp)(2).Value = cboProjectTitle.Text
Worksheets("OutputData").Range("B65536")._
End(xlUp)(2).Value = cboStateInput.Text

'''Update dynamic named range in column A named dynProjectTitle
Sheets("OutputData").cboDynEditEntry._
ListFillRange = "dynProjectTitle"

Unload Me
Application.ScreenUpdating = True

End Sub


Thanks again.
James KD

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dyn Named Range update from userform

try

'''Update dynamic named range in column A named dynProjectTitle
Sheets("OutputData").Calculate
doevents
Sheets("OutputData").cboDynEditEntry._
ListFillRange = "dynProjectTitle"


if that doesn't help, show the formula you are using to define you dynamic
name range.

--
Regards
Tom Ogilvy


"KD" wrote in message
ups.com...
Hi All:

Some help here would be great. I am falling a little short on the
nuances of procedures that include dynamic named range.

I have a fairly large multipage userform that validates entries,
calculates some risk metrics and puts all data (input and output) into
an output worksheet. The output worksheet has a combobox
(cbodynEditEntry) that allows the user to edit a particular row.
cbodynEditEntry has a listfillrange that is a dynamic named range
representing the first column (rangename=dynProjectTitle).

The problem is not in running a new project through the userform, but
in editing an existing. My logic was to, upon selection of existing
project (either in userform or output sheet), find row with same
project title, delete that row, and repopulate with the modified data
stored in the userform. When I do this, the first column does not
delete and update. It only deletes. This then messes up
cbodynEditEntry. Some sample code follows. Thanks much and hope to
return the favor.

--------------------------------------------------------------------------

----------------------------------------
Private Sub Run_Click
Dim title as Range
Application.ScreenUpdating = False
On Error Resume Next

'''Find matching project title in row and delete row
Sheets("OutputData").Select
Set title = Range("dynProjectTitle")._
Find(cboProjectTitle.Value)
title.Select
ActiveCell.EntireRow.Delete shift:=xlShiftUp

'''Populate from userform ***The A procedure does not work. B works
fine.***
Worksheets("OutputData").Range("A65536")._
End(xlUp)(2).Value = cboProjectTitle.Text
Worksheets("OutputData").Range("B65536")._
End(xlUp)(2).Value = cboStateInput.Text

'''Update dynamic named range in column A named dynProjectTitle
Sheets("OutputData").cboDynEditEntry._
ListFillRange = "dynProjectTitle"

Unload Me
Application.ScreenUpdating = True

End Sub


Thanks again.
James KD



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Dyn Named Range update from userform

Thanks Tom.

It works, but can you explain to me how it worked? I am familiar with
'doevents', but not in this usage.

Thanks again,

James KD

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dyn Named Range update from userform

The processor works on one thing at a time. within the grand scheme of
things, the operating system allocates out use of the processor to all the
different processes and with a process like Excel, VBA also gets allocated
some processing time. When VBA is running a demanding task, it may not
relinquish the processor to allow other processes and subprocesses to run.
Doevents tells VBA to "rest" and let the other processes catch up on their
work. It isn't a major pause or anything, but sometimes it helps when you
are depending on other things to happen such as in your case.

You might try it without the Doevents and see if the calculate alone is
enough. Or try a ThisWorkbook.Calculate instead of the sheet level
calculate. Or just leave the Doevents in.

--
Regards,
Tom Ogilvy





"KD" wrote in message
oups.com...
Thanks Tom.

It works, but can you explain to me how it worked? I am familiar with
'doevents', but not in this usage.

Thanks again,

James KD



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Dyn Named Range update from userform

Great. Thank you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
automatically update pivot tables when dynamic named range is expa Dave F Excel Discussion (Misc queries) 10 November 23rd 06 01:51 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM
Data validation named range update Phil Deem Excel Programming 2 July 18th 05 02:56 PM
Data validation named range update Phil Deem Excel Discussion (Misc queries) 3 July 16th 05 03:55 AM


All times are GMT +1. The time now is 10:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"