ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sizing of copied columns (https://www.excelbanter.com/excel-programming/342377-sizing-copied-columns.html)

Nigel[_26_]

Sizing of copied columns
 

Hi

Many thanks to Ron for the help he has already given me with this
project, however I am copying a worksheet template to a different
folder and cant get the columns to size correctly. The code I am using
I have listed below.....is it obvious what I am doing wrong?


Private Sub CommandButton4_Click()
Dim wipnum As String

Dim na As String


ActiveSheet.Range("B2:H42").Select

Selection.Copy

Workbooks.Add

na = ActiveWorkbook.Name

ActiveSheet.Range("B2").Select

ActiveSheet.Paste

Application.CutCopyMode = False

ActiveWindow.Zoom = 75

Columns("B:B").ColumnWidth = 12.86

Columns("E:E").ColumnWidth = 12.86

Columns("D:D").ColumnWidth = 12.86

Columns("c:c").ColumnWidth = 12.86

Columns("G:G").ColumnWidth = 12.86
Columns("H:H").ColumnWidth = 12.86

Columns("F:F").ColumnWidth = 12.86


wipnum = Range("C2")


Windows("ESTIMA2.XLS").Activate

ActiveSheet.Range("O5").Select

Application.CutCopyMode = False

Selection.Copy

ActiveSheet.Range("C2").Select

Windows(na).Activate

ActiveSheet.Range("O5").Select

ActiveSheet.Paste

ActiveSheet.Range("C2").Select

ActiveWorkbook.SaveAs Filename:="G:\Docs\ESTTRI\" & wipnum &
".xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False

Windows("ESTIMA2.XLS").Activate


ActiveSheet.Range("a1").Select

MsgBox "File saved as " & wipnum & ".xls", vbOKOnly, "File Saved
Sucessfully"



End Sub

I am a complete novice with VBA and the code you see above I have had a
lot of help from various people to get this far. So if you could keep
any answer as simple as possible I would appreciate it.

Regards

Nigel


--
Nigel
------------------------------------------------------------------------
Nigel's Profile: http://www.excelforum.com/member.php...o&userid=25696
View this thread: http://www.excelforum.com/showthread...hreadid=474803



All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com