Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
a quick way of inserting and naming multiple worksheets in Excel? | Excel Worksheet Functions | |||
naming a range | Excel Programming | |||
naming a range | Excel Programming | |||
VB Code Naming a Range (range changes each time) | Excel Programming | |||
Inserting Sheets and Naming | Excel Programming |