Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ina ina is offline
external usenet poster
 
Posts: 120
Default rewrite in range

Hello,

I have this piece of code that each time that sets a range and assign
this data to the range.

Dim rngNextCell As Range
Set rngNextCell = Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)


rngNextCell.Resize(UBound(vartbl, 1) - LBound(vartbl, 1) + 1,
UBound(vartbl, 2) - LBound(vartbl, 2) + 1).Value = vartbl


What I would like to do it that the next time a run this macro, the
actual range will be rewrited by the new range

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default rewrite in range

Dim rngNextCell As Range
Dim r as Range
on Error Resume Next
set rngNextCell = Range("MyData").RefersToRange
On Error goto 0
if rngNextCell is nothing then
Set rngNextCell = Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
End if

set r = rngNextCell(1).Resize(UBound(vartbl, 1) - LBound(vartbl, 1) + 1,
UBound(vartbl, 2) - LBound(vartbl, 2) + 1).Value

r = vartbl
r.Name = "MyData"

--
Regards,
Tom Ogilvy


"ina" wrote:

Hello,

I have this piece of code that each time that sets a range and assign
this data to the range.

Dim rngNextCell As Range
Set rngNextCell = Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)


rngNextCell.Resize(UBound(vartbl, 1) - LBound(vartbl, 1) + 1,
UBound(vartbl, 2) - LBound(vartbl, 2) + 1).Value = vartbl


What I would like to do it that the next time a run this macro, the
actual range will be rewrited by the new range


  #3   Report Post  
Posted to microsoft.public.excel.programming
ina ina is offline
external usenet poster
 
Posts: 120
Default rewrite in range

thank you tom :)

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
Rewrite name in new format ALaw Excel Discussion (Misc queries) 4 February 6th 08 04:52 PM
vlookup [rewrite] Janis Excel Discussion (Misc queries) 0 July 25th 07 10:36 PM
How can I rewrite this using an Array? Fred[_21_] Excel Programming 7 September 13th 05 05:45 PM
How to Rewrite these Code? hce[_16_] Excel Programming 1 September 29th 04 03:33 AM
How to Rewrite these Code? hce[_15_] Excel Programming 1 September 29th 04 01:22 AM


All times are GMT +1. The time now is 06:28 PM.

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

About Us

"It's about Microsoft Excel"