PC Review


Reply
Thread Tools Rate Thread

Copy Column Formats

 
 
Risky Dave
Guest
Posts: n/a
 
      27th Jun 2009

Hi,

I have a short piece of code that finds the last entry in a row and then
inserts a new column. what should happen is that all formats from should be
duplicated, but for some reason cell borders are not being copied.

Set rCtr = Sheets("badges").Range("d1") ' add new name to badges
list
Do
If rCtr.Value <> "" Then
Set rCtr = rCtr.Offset(0, 1)
Else
rCtr.EntireColumn.Insert ,_
CopyOrigin:=xlFormatFromLeftOrAbove
rCtr.Offset(0, -1) = FmNewBeaver.tbName
Exit Do
End If
Loop

Can anyone suggest why this is happening and how to fix it?

TIA

Dave
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      27th Jun 2009

Try this vba

Sub copycolSAS()
Dim lc As Long
With Sheets("badges")
lc = .Cells(1, Columns.Count).End(xlToLeft).Column
.Columns("d").Copy
.Columns(lc).Insert
End With
Application.CutCopyMode = False
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Risky Dave" <(E-Mail Removed)> wrote in message
news:2850FF43-8098-43B2-89E9-(E-Mail Removed)...
> Hi,
>
> I have a short piece of code that finds the last entry in a row and then
> inserts a new column. what should happen is that all formats from should
> be
> duplicated, but for some reason cell borders are not being copied.
>
> Set rCtr = Sheets("badges").Range("d1") ' add new name to badges
> list
> Do
> If rCtr.Value <> "" Then
> Set rCtr = rCtr.Offset(0, 1)
> Else
> rCtr.EntireColumn.Insert ,_
> CopyOrigin:=xlFormatFromLeftOrAbove
> rCtr.Offset(0, -1) = FmNewBeaver.tbName
> Exit Do
> End If
> Loop
>
> Can anyone suggest why this is happening and how to fix it?
>
> TIA
>
> Dave


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy column, paste special formulas & number formats doesn't work Beckey Microsoft Excel Misc 3 30th Jul 2009 07:51 PM
Copy and past ... and maintain all formats including column widths JERRY Microsoft Excel Discussion 2 21st May 2007 02:29 AM
Copy Color Formats Based On Column Date Values Naji Microsoft Excel Misc 0 11th Jan 2006 09:06 PM
copy formats column width & row heights between Excel WORKSHEETS? =?Utf-8?B?dGNjYzEyMTk=?= Microsoft Excel Misc 5 8th Nov 2005 04:22 PM
copy a sheet with all formats - column widths, etc? =?Utf-8?B?UmljaA==?= Microsoft Excel Programming 2 26th Apr 2005 09:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:58 AM.