Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Background Color

In this macro, How do you include the background color format?
Color is on Sheet 2, would like to have it carried across to sheet 1
along with data. Any color, but I am using color 3 (green).
----------------------------------------------
Sub Newer2() 'Final Code
Dim rCell As Range
Dim rCell2 As Range

For Each rCell2 In Sheet2.Range("A2:A150") 'adjust for how many rows
you want to copy
With Sheet1.Range(rCell2.Offset(0, 0).Address) 'Header row has
description row one
.Value = rCell2.Value
For Each rCell In rCell2.Offset(0, 1).Resize(1, 8) 'change all
the columns you need
.Offset(0, rCell.Value).Value = rCell.Value
Next rCell
End With
Next rCell2
End Sub
------------------------------------------------
With Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Background Color

Instead of the Value property you can use pasteSpecial.
paste the Formats first and then the values

See the VBA help for pastespecial

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"smandula" wrote in message oups.com...
In this macro, How do you include the background color format?
Color is on Sheet 2, would like to have it carried across to sheet 1
along with data. Any color, but I am using color 3 (green).
----------------------------------------------
Sub Newer2() 'Final Code
Dim rCell As Range
Dim rCell2 As Range

For Each rCell2 In Sheet2.Range("A2:A150") 'adjust for how many rows
you want to copy
With Sheet1.Range(rCell2.Offset(0, 0).Address) 'Header row has
description row one
.Value = rCell2.Value
For Each rCell In rCell2.Offset(0, 1).Resize(1, 8) 'change all
the columns you need
.Offset(0, rCell.Value).Value = rCell.Value
Next rCell
End With
Next rCell2
End Sub
------------------------------------------------
With Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Background Color

On Apr 27, 4:59 pm, "Ron de Bruin" wrote:
Instead of the Value property you can use pasteSpecial.
paste the Formats first and then the values

See the VBA help for pastespecial

I need more help in executing your suggestion.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Background Color

Can you tell me what you exactly want to do?
When reading your code it is not clear to me

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"smandula" wrote in message ups.com...
On Apr 27, 4:59 pm, "Ron de Bruin" wrote:
Instead of the Value property you can use pasteSpecial.
paste the Formats first and then the values

See the VBA help for pastespecial

I need more help in executing your suggestion.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Background Color

Thanks for your come back.
I don't know if it's possible using pasteSpecial.

Sheet 2 has variable columns, in this example case 9 columns
by 150 rows, all rows and columns are filled with data on
Sheet2.

However, on Sheet 1 where this data is being copied to,the rows
and columns are different in size. Namely, 48 columns by 150 rows.
This part of the macro works great.

I would like to color some cells of the 9 columns per row bases
of Sheet 2 and be able to copy these colored items on Sheet 1,
at the same time the individual cell value is being copied.

I value your opinion, in that if it's possible within the given macro,
or if a separate macro is needed.

With Thanks



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Background Color

you offset with a cell value ?
..Offset(0, rCell.Value).

Can you explain

Which range do you want to copy and where

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"smandula" wrote in message ups.com...
Thanks for your come back.
I don't know if it's possible using pasteSpecial.

Sheet 2 has variable columns, in this example case 9 columns
by 150 rows, all rows and columns are filled with data on
Sheet2.

However, on Sheet 1 where this data is being copied to,the rows
and columns are different in size. Namely, 48 columns by 150 rows.
This part of the macro works great.

I would like to color some cells of the 9 columns per row bases
of Sheet 2 and be able to copy these colored items on Sheet 1,
at the same time the individual cell value is being copied.

I value your opinion, in that if it's possible within the given macro,
or if a separate macro is needed.

With Thanks

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Background Color

You've got another suggestion at your other post.

smandula wrote:

In this macro, How do you include the background color format?
Color is on Sheet 2, would like to have it carried across to sheet 1
along with data. Any color, but I am using color 3 (green).
----------------------------------------------
Sub Newer2() 'Final Code
Dim rCell As Range
Dim rCell2 As Range

For Each rCell2 In Sheet2.Range("A2:A150") 'adjust for how many rows
you want to copy
With Sheet1.Range(rCell2.Offset(0, 0).Address) 'Header row has
description row one
.Value = rCell2.Value
For Each rCell In rCell2.Offset(0, 1).Resize(1, 8) 'change all
the columns you need
.Offset(0, rCell.Value).Value = rCell.Value
Next rCell
End With
Next rCell2
End Sub
------------------------------------------------
With Thanks


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Background Color

Thanks everyone for listening

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
Checkbox to change background color, font color and remove/ add bo Sara Excel Discussion (Misc queries) 2 May 1st 23 11:43 AM
how can I conditionally change font color, or background color? MOHA Excel Worksheet Functions 3 August 21st 06 06:57 PM
Cell background color (interior color) setting not working Martin E. Excel Programming 1 May 21st 06 07:00 PM
Default Border, Font Color, and Cell Background Color Elijah Excel Discussion (Misc queries) 1 October 28th 05 04:10 PM
Excel 2003 Font Color and Background Color DrankPA6 Excel Discussion (Misc queries) 1 August 12th 05 11:43 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"