Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default moving cells value and font only (no other formats i.e. boarders)

I would like to move a cells value and font as well ... but with no other
cell formating. I have the following code that works perfectly with the cells
value, except that the cells that are moved take on the cell format of the
cells that the original content is being moved to.


Dim vTemp As Variant
With Selection
If .Count < 2 Then
MsgBox "2 courses only."
Else
If .Areas.Count = 2 Then
vTemp = .Areas(1).Cells.Value
.Areas(1).Cells.Value = .Areas(2).Cells.Value
.Areas(2).Cells.Value = vTemp
vTemp = .Areas(1).Offset(1, 0).Cells.Value
.Areas(1).Offset(1, 0).Cells.Value = .Areas(2).Offset(1,
0).Cells.Value
.Areas(2).Offset(1, 0).Cells.Value = vTemp

Else
vTemp = .Cells(1).Value
.Cells(1).Value = .Cells(2).Value
.Cells(2).Value = vTemp
End If
End If
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default moving cells value and font only (no other formats i.e. boarders)

hi
you have to add a line to move the font when you move the values
somthing like...
..Areas(1).Cells.Value = .Areas(2).Cells.Value
..areas(1).cells.font.name = .areas(2).cells.font.name

Regards
FSt1

"Prohock" wrote:

I would like to move a cells value and font as well ... but with no other
cell formating. I have the following code that works perfectly with the cells
value, except that the cells that are moved take on the cell format of the
cells that the original content is being moved to.


Dim vTemp As Variant
With Selection
If .Count < 2 Then
MsgBox "2 courses only."
Else
If .Areas.Count = 2 Then
vTemp = .Areas(1).Cells.Value
.Areas(1).Cells.Value = .Areas(2).Cells.Value
.Areas(2).Cells.Value = vTemp
vTemp = .Areas(1).Offset(1, 0).Cells.Value
.Areas(1).Offset(1, 0).Cells.Value = .Areas(2).Offset(1,
0).Cells.Value
.Areas(2).Offset(1, 0).Cells.Value = vTemp

Else
vTemp = .Cells(1).Value
.Cells(1).Value = .Cells(2).Value
.Cells(2).Value = vTemp
End If
End If
End With
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default moving cells value and font only (no other formats i.e. boarde

This unfortunately only puts the font name in the other cell i.e. arial. I
want the value and the cells font format.

"FSt1" wrote:

hi
you have to add a line to move the font when you move the values
somthing like...
.Areas(1).Cells.Value = .Areas(2).Cells.Value
.areas(1).cells.font.name = .areas(2).cells.font.name

Regards
FSt1

"Prohock" wrote:

I would like to move a cells value and font as well ... but with no other
cell formating. I have the following code that works perfectly with the cells
value, except that the cells that are moved take on the cell format of the
cells that the original content is being moved to.


Dim vTemp As Variant
With Selection
If .Count < 2 Then
MsgBox "2 courses only."
Else
If .Areas.Count = 2 Then
vTemp = .Areas(1).Cells.Value
.Areas(1).Cells.Value = .Areas(2).Cells.Value
.Areas(2).Cells.Value = vTemp
vTemp = .Areas(1).Offset(1, 0).Cells.Value
.Areas(1).Offset(1, 0).Cells.Value = .Areas(2).Offset(1,
0).Cells.Value
.Areas(2).Offset(1, 0).Cells.Value = vTemp

Else
vTemp = .Cells(1).Value
.Cells(1).Value = .Cells(2).Value
.Cells(2).Value = vTemp
End If
End If
End With
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default moving cells value and font only (no other formats i.e. boarde

no, that put the font style in the cell. at least in did on my pc. using xp
here. i tested before i posted.

regards
FSt1

"Prohock" wrote:

This unfortunately only puts the font name in the other cell i.e. arial. I
want the value and the cells font format.

"FSt1" wrote:

hi
you have to add a line to move the font when you move the values
somthing like...
.Areas(1).Cells.Value = .Areas(2).Cells.Value
.areas(1).cells.font.name = .areas(2).cells.font.name

Regards
FSt1

"Prohock" wrote:

I would like to move a cells value and font as well ... but with no other
cell formating. I have the following code that works perfectly with the cells
value, except that the cells that are moved take on the cell format of the
cells that the original content is being moved to.


Dim vTemp As Variant
With Selection
If .Count < 2 Then
MsgBox "2 courses only."
Else
If .Areas.Count = 2 Then
vTemp = .Areas(1).Cells.Value
.Areas(1).Cells.Value = .Areas(2).Cells.Value
.Areas(2).Cells.Value = vTemp
vTemp = .Areas(1).Offset(1, 0).Cells.Value
.Areas(1).Offset(1, 0).Cells.Value = .Areas(2).Offset(1,
0).Cells.Value
.Areas(2).Offset(1, 0).Cells.Value = vTemp

Else
vTemp = .Cells(1).Value
.Cells(1).Value = .Cells(2).Value
.Cells(2).Value = vTemp
End If
End If
End With
End Sub

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
Fixed font formats Karsa Excel Discussion (Misc queries) 2 February 6th 08 01:14 PM
Moving Cell Formats Chart_Maker_Wonderer Setting up and Configuration of Excel 1 July 23rd 07 09:52 PM
Dropdown list for font size, font type and number formats ExcelMonkey[_190_] Excel Programming 1 March 9th 05 03:50 PM
Excel font formats Angie Kay Excel Discussion (Misc queries) 3 February 4th 05 03:40 AM


All times are GMT +1. The time now is 12:01 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"