Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2007

Tip: Looking for answers? Try searching our database.

Removing selection and maintaining formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mantrid - 22 Apr 2007 17:41 GMT
Hello
Im using the following code to insert a row at a particular point (that
changes), and copy the row above into it. It works OK but for two slight
problems
1) The newly added line remains selected (flashing dotted line around the
row) after the event. I have tried using deselect but I cant get it to work

With ActiveSheet
   .Rows(RowNo - 1).Copy
   .Rows(RowNo - 1).Insert (xlShiftDown)
   .Paste Destination:=ActiveSheet.Rows(RowNo)
End With

2) Then after the previous code I use some more code as below

ActiveSheet.Cells(RowNo, 7).Value = Me.purchasedate
ActiveSheet.Cells(RowNo, 8).Value = Me.price
ActiveSheet.Cells(RowNo, 9).Value = Me.charges
ActiveSheet.Cells(RowNo, 20).Value = Me.price

To add numbers input on a form to populate the cells on the new row. Trouble
is the cells where the data is added loose their number formatting, and the
little green triangle in the top left of the cell appears giving the
message;
'The number in this cell is formatted as text or preceeded by an apostrophe'

Any idea anyone how I can resolve these problems?
Thank
Ian
Nick Hodge - 22 Apr 2007 18:08 GMT
Mantrid

1) Application.CutCopyMode=False will stop the 'marching ants'
2) Coerce the values e.g

ActiveSheet.Cells(RowNo, 7).Value = CDate(Me.purchasedate)
Signature

HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS
web: www.nickhodge.co.uk
blog: www.nickhodge.co.uk/blog/

FREE UK OFFICE USER GROUP MEETING, MS READING, 27th APRIL 2007
www.officeusergroup.co.uk

> Hello
> Im using the following code to insert a row at a particular point (that
[quoted text clipped - 29 lines]
> Thank
> Ian
mantrid - 22 Apr 2007 19:47 GMT
Thanks Nick
That worked fine
I presume you should

Application.CutCopyMode=TRUE

After the event?
Ian

> Mantrid
>
[quoted text clipped - 35 lines]
> > Thank
> > Ian
Nick Hodge - 22 Apr 2007 22:48 GMT
Mantrid

No it's a one way operation, no need to place Excel back in that mode.

Signature

HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
nick_hodgeTAKETHISOUT@zen.co.ukANDTHIS
web: www.nickhodge.co.uk
blog: www.nickhodge.co.uk/blog/

FREE UK OFFICE USER GROUP MEETING, MS READING, 27th APRIL 2007
www.officeusergroup.co.uk

> Thanks Nick
> That worked fine
[quoted text clipped - 46 lines]
>> > Thank
>> > Ian

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.