LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Location: South Wales, UK
Posts: 11
Default Addition to current VBA - Keep text format

Hi

I have the current VBA code which works really well in creating and copying data to new tabs. All i want to do is to make sure when it copies over the data in to new tabs that the text formatting copies over too. For example, the column headings are to be bold and the column containing time stays in a time format.

Can anyone help?


Sub CreateTabs()
Dim a, i As Long, j As Long, NR As Long, LR&, ws As Worksheet
Dim sName As String
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "Data" Then
ws.Cells.ClearContents
End If
Next

With Worksheets("Data")
a = .Range("a2").CurrentRegion.Value
End With

For i = 2 To UBound(a)
sName = a(i, 1) & "_EMA_FF"
If Not Evaluate("=ISREF('" & sName & "'!A1)") Then
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name = sName
End If
With Worksheets(sName)
NR = .Cells(Rows.Count, "a").End(xlUp).Row + 1
For j = 1 To UBound(a, 2)
.Cells(1, j) = a(1, j)
.Cells(NR, j) = a(i, j)
.Columns.AutoFit
Next
End With
Next
End Sub
 
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
Automatic addition of Text stew Excel Discussion (Misc queries) 12 January 17th 09 09:04 PM
format cell if date not current Becky Excel Worksheet Functions 2 December 17th 08 06:16 PM
Date addition/format gjameson via OfficeKB.com Excel Programming 5 February 19th 07 01:18 PM
how do i add the same text after current text in multiple cells Sue Excel Discussion (Misc queries) 3 January 13th 05 09:28 PM
I want to sort data randomly in addition to the current descendin. ckephart Excel Worksheet Functions 2 November 12th 04 06:11 PM


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