Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default Inserting a row in one named range and having it update another

Hi
I am trying to insert a row into a named range and have it update the size
of another range so that they are both identical and make the data in each
range the same.

I think I am almost there but not quite.
Also the below code is a little more then needed but I was using it for some
tests.
Can anyone help me get to that result?

Also, I would love this to happen on a change event, "if" the named range is
changed

Any help is appreciated

Thanks!
Mark

Sub UpdateRange()

Dim Sh1bW As Range
Dim RowNums As Integer
Dim CurrRow As Long

Set Sh1bW = Range("Sh1billsW")

'If a row is added or deleted to/from the range, return the range row count
If Sh1bW.Rows.Count + 1 Then
RowNums = Sh1bW.Rows.Count
'MsgBox "Number of Rows = " & RowNums
Sh1bW.Rows.Select
End If

'Return the row and value of each cell in the range
For Each Cell In Sh1bW
CurrRow = Cell.Row
'MsgBox "Row " & CurrRow & " = " & vbCrLf & Cell.Value
'Debug.Print "Row " & CurrRow & " = " & vbCrLf & Cell.Value
Next Cell
MsgBox RowNums

Dim Sh1bM As Range
Set Sh1bM = Range("Sh1billsM")

Sh1bM.Rows.Resize = RowNums

For Each Cell In Sh1bW
Sh1bM.Cells.Value = Sh1bW.Cells.Value
Sh1bM.Rows.Select
Next Cell

MsgBox Sh1bM.Rows.Count

End Sub



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
Inserting a named range while recording a macro mrogge2895 Excel Programming 0 February 26th 08 10:26 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
Dyn Named Range update from userform KD[_5_] Excel Programming 4 February 7th 06 08:16 PM
Data validation named range update Phil Deem Excel Discussion (Misc queries) 3 July 16th 05 03:55 AM
Inserting data within a named range..HELP sulrich Excel Programming 2 February 18th 05 06:16 PM


All times are GMT +1. The time now is 05:49 AM.

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"