Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 15
Default Removing selection and maintaining formatting

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



  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 1,173
Default Removing selection and maintaining formatting

Mantrid

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

ActiveSheet.Cells(RowNo, 7).Value = CDate(Me.purchasedate)
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
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

"mantrid" wrote in message
...
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




  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 15
Default Removing selection and maintaining formatting

Thanks Nick
That worked fine
I presume you should

Application.CutCopyMode=TRUE

After the event?
Ian


"Nick Hodge" wrote in message
...
Mantrid

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

ActiveSheet.Cells(RowNo, 7).Value = CDate(Me.purchasedate)
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
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

"mantrid" wrote in message
...
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






  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel
external usenet poster
 
Posts: 1,173
Default Removing selection and maintaining formatting

Mantrid

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

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
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

"mantrid" wrote in message
...
Thanks Nick
That worked fine
I presume you should

Application.CutCopyMode=TRUE

After the event?
Ian


"Nick Hodge" wrote in message
...
Mantrid

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

ActiveSheet.Cells(RowNo, 7).Value = CDate(Me.purchasedate)
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
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

"mantrid" wrote in message
...
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







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
Maintaining currency formatting in a Mail Merge? Martinson44 Excel Discussion (Misc queries) 2 September 15th 07 09:57 PM
Maintaining Formatting in a UserForm Rawce Excel Programming 6 October 26th 06 08:43 AM
Maintaining pivot table formatting gonger[_11_] Excel Programming 3 July 24th 06 10:00 PM
Maintaining formatting - Excel = Word ChrisMattock[_4_] Excel Programming 7 May 11th 06 08:37 AM
Maintaining Text Formatting in a Lookup loscherland Excel Discussion (Misc queries) 2 April 21st 06 04:26 PM


All times are GMT +1. The time now is 08:48 PM.

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"