Sum tables keeping the same format

Status
Not open for further replies.

glottis

New Member
Joined
Oct 21, 2011
Messages
11
Hi,

I am trying to create a new table starting from three others (that are in the 3 previous sheet). I succeeded but unfortunately the resulting table is not keeping the same format. Could you advise please?

VBA Code:
Set cell_range = Range("A4:Z50")

                              SheetCount = .Worksheets.Count
                 
                        If WorksheetFunction.CountA(Cells) <> 0 Then
                      
                       .Worksheets.Add After:=.Worksheets(SheetCount)
                         End If
                         
                         SheetCount = .Worksheets.Count
                         
                        For Each Cell In cell_range
                        
                        If IsNumeric(.Worksheets(SheetOne).Range(Cell.Address).Value) Then
                        
                        
                        .Worksheets(SheetCount).Range(Cell.Address).Value = .Worksheets(SheetThree).Range(Cell.Address).Value + .Worksheets(SheetOne).Range(Cell.Address).Value + .Worksheets(SheetTwo).Range(Cell.Address).Value
                        
                        Else
                        
                        .Worksheets(SheetCount).Range(Cell.Address).Value = .Worksheets(SheetThree).Range(Cell.Address).Value
                        
                        End If
                        
                        Next Cell
                        
                        
                        
                        End With
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Format can mean many things, which do you want?

Number format?
Fill colour?
Font?
Border?
Conditional format?
Something else that I missed?

Several, or all of the above?
 
Upvote 0
Thanks for the reply Jason. Basically I want to keep the cell merged as per word. Here below as it's the word doc:
1612299392878.png


and here's the actual outcome:

1612299409402.png


AS you can spot, the actual script is reporting wrongly 1-4 as a date (4-Jan) and the cell below <1 is splitted in two. About colour and font I don't care. Thank you!!!
 
Upvote 0
Duplicate to: Format error

In future, please do not post the same question multiple times. Per Forum Rules (#12), posts of a duplicate nature will be locked or deleted.

In relation to your question here, I have closed this thread so please continue in the linked thread. If you do not receive a response, you can "bump" it by replying to it yourself, though we advise you to wait 24 hours before doing so, and not to bump a thread more than once a day.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,215,430
Messages
6,124,853
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top