Re: Adding a column that has format
From: Dave Peterson (ec35720_at_msn.com)
Date: 03/13/04
- Next message: **{Steven}**: "Re: Formatting cells"
- Previous message: CLR: "Re: Formulaneeded for extraction"
- In reply to: Steve L.: "Re: Adding a column that has format"
- Next in thread: Steve L.: "Re: Adding a column that has format"
- Reply: Steve L.: "Re: Adding a column that has format"
- Reply: Steve L.: "Re: Adding a column that has format"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 13 Mar 2004 11:08:10 -0600
Each post to the newsgroup is archived in google. If you explain in plain text,
then your post (and suggestions) will be kept there for people who may need the
same kind of solution.
But google won't archive attachments and your pdf documents and web pages are
probably temporary and won't get archived either. So those links/attachments
won't help anyone who's searching later.
And I try not to open attachments or click on links to other stuff. Lots of bad
stuff can happen and I'm not (usually) willing to take the risk--no matter how
small.
That said, I clicked on your web link (bad Dave!).
It looks like your headers are in Row 4. And you want to insert between the
last used column and the next to last used column.
I don't see how the numbered heading and adding 1 fits in.
But this might be closer to what you want.
Option Explicit
Sub testme01()
Dim myCol As Long
With Active***
myCol = .Cells(4, .Columns.Count).End(xlToLeft).Column - 1
If myCol = 1 Then
MsgBox "I can't copy from the left of this column!"
Exit Sub
End If
.Columns(myCol + 1).Insert
.Columns(myCol).Copy
.Columns(myCol + 1).PasteSpecial Paste:=xlPasteFormats, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
.Cells(1, myCol + 1).Select
End With
Application.CutCopyMode = False
End Sub
Notice that the myCol (I renamed it from LastCol to match the existing code) now
uses:
.cells(4,.columns.count).end(xltoleft).column -1
That 4 means row 4.
the .columns.count means 256, the .end(xltoleft) is like going to IV4 and
hitting End, then left arrow.
It'll take you to the last used cell in that row. Then I subtract to go back
one more.
I dropped the stuff about adding 1 since I didn't see that in your page.
If this is wrong, please take the time to describe what you want in plain text.
(I don't like breaking my rules <vbg>.)
"Steve L." wrote:
>
> Dave Peterson <ec35720@msn.com> wrote in news:40530054.648A3483@msn.com:
>
> > I don't open attachments.
> >
>
> OK, so I made it a regular .html page
> Have a look?
>
> http://www.kraftworksremodel.com/Estimate%20vs%20actual.htm
>
> Thanks Dave.
>
> Someday the light bulb will power up above my head.
-- Dave Peterson ec35720@msn.com
- Next message: **{Steven}**: "Re: Formatting cells"
- Previous message: CLR: "Re: Formulaneeded for extraction"
- In reply to: Steve L.: "Re: Adding a column that has format"
- Next in thread: Steve L.: "Re: Adding a column that has format"
- Reply: Steve L.: "Re: Adding a column that has format"
- Reply: Steve L.: "Re: Adding a column that has format"
- Messages sorted by: [ date ] [ thread ]