Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default inserting and naming range

I have the following start to some code. I want to insert a copy of the
range baluster_blank above it and name it baluster1, unless that name is
already being used, in which case baluster2, unless that is used and then
baluster3, and so on.
Sub insertbalusterrow()
Dim rng As Range
Set rng = Range("baluster_blank")
rng.Copy
rng.Insert 1, yes

Where should i go from here? THanks.

--
Message posted via http://www.officekb.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default inserting and naming range

I'm not sure this is what you really want but test with a cell named "bal"
before changing.

Sub copyrangeandname()
With Range("bal")
.Offset(1).Insert
i = 1
On Error GoTo nameit
mn = ThisWorkbook.Names("bal" & i).Name
mn = (Err.Number = 0)
i = i + 1
nameit:
.Offset(1).Name = "bal" & i
End With
End Sub

--
Don Guillett
SalesAid Software

"brownti via OfficeKB.com" <u31540@uwe wrote in message
news:6fcf296b6af28@uwe...
I have the following start to some code. I want to insert a copy of the
range baluster_blank above it and name it baluster1, unless that name is
already being used, in which case baluster2, unless that is used and then
baluster3, and so on.
Sub insertbalusterrow()
Dim rng As Range
Set rng = Range("baluster_blank")
rng.Copy
rng.Insert 1, yes

Where should i go from here? THanks.

--
Message posted via
http://www.officekb.com



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default inserting and naming range

yea- i adapted that and got it working right. thanks!



Don Guillett wrote:
I'm not sure this is what you really want but test with a cell named "bal"
before changing.

Sub copyrangeandname()
With Range("bal")
.Offset(1).Insert
i = 1
On Error GoTo nameit
mn = ThisWorkbook.Names("bal" & i).Name
mn = (Err.Number = 0)
i = i + 1
nameit:
.Offset(1).Name = "bal" & i
End With
End Sub

I have the following start to some code. I want to insert a copy of the
range baluster_blank above it and name it baluster1, unless that name is

[quoted text clipped - 7 lines]

Where should i go from here? THanks.


--
Message posted via http://www.officekb.com

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
a quick way of inserting and naming multiple worksheets in Excel? Sue[_4_] Excel Worksheet Functions 5 December 4th 09 10:36 PM
naming a range Jo[_6_] Excel Programming 1 June 24th 04 11:02 PM
naming a range Jo[_6_] Excel Programming 2 June 24th 04 09:39 PM
VB Code Naming a Range (range changes each time) krazylain Excel Programming 4 May 15th 04 12:41 PM
Inserting Sheets and Naming Dan Gesshel Excel Programming 5 April 15th 04 01:52 AM


All times are GMT +1. The time now is 12:22 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"