![]() |
worksheet question
Hi,
I am quite new to this so go easy !, I have the code (donted - thanks) below that will create a new worksheet with the name changed to some data input by the user. my question is it possible to 'format' parts of this worksheet ie show data in cell B13 as 'bold' and to add three 'heading's to 3 different cells. so by default I want the newly created worksheet to have the following 'standard' settings. cells D13:D17 and F13:F17 to be formatted to show values in £ cell D12 to show the word "PRICE" in bold size 12 cell B25 to be text size 20 in colour red and also bold. is this possible - if so how?? oh yes here is the code I have Sub NewSheet() Dim x As Worksheet Dim y As Worksheet Dim z As Variant Set x = ActiveSheet With Sheets.Add ActiveSheet.Name = x.Range("B2") Set y = ActiveSheet z = Array(x.Range("B2"), x.Range("B4") y.Range("B3") = z(0) 'NAME y.Range("D3") = z(1) 'BOOKING REF End With MsgBox "Thank You, Order Created Successfully !", vbInformation End Sub many many thanks |
Anthony,
Although the code could put all the stuff in the sheet, you could also just make a sheet to use as a basis, and copy it when you need a new one. That way, when you change the layout (or formatting, or whatever) of the sheet, as you will, mark my words, you won't have to change a bunch of code. You could hide the sheet. Sub NewInvoice() Sheets("Invoice master").Visible = True Sheets("Invoice Master").Copy After:=ActiveSheet 'ActiveSheet.Name = Sheets("Invoice Master").Visible = False -- Earl Kiosterud www.smokeylake.com/ ------------------------------------------- "Anthony" wrote in message ... Hi, I am quite new to this so go easy !, I have the code (donted - thanks) below that will create a new worksheet with the name changed to some data input by the user. my question is it possible to 'format' parts of this worksheet ie show data in cell B13 as 'bold' and to add three 'heading's to 3 different cells. so by default I want the newly created worksheet to have the following 'standard' settings. cells D13:D17 and F13:F17 to be formatted to show values in £ cell D12 to show the word "PRICE" in bold size 12 cell B25 to be text size 20 in colour red and also bold. is this possible - if so how?? oh yes here is the code I have Sub NewSheet() Dim x As Worksheet Dim y As Worksheet Dim z As Variant Set x = ActiveSheet With Sheets.Add ActiveSheet.Name = x.Range("B2") Set y = ActiveSheet z = Array(x.Range("B2"), x.Range("B4") y.Range("B3") = z(0) 'NAME y.Range("D3") = z(1) 'BOOKING REF End With MsgBox "Thank You, Order Created Successfully !", vbInformation End Sub many many thanks |
Earl,thanks for ur reply,but not sure if I follow.
where do I put this code?? do I add to to the one I have .... sorry to sound dumb but I did warn you I was new to this thanks "Earl Kiosterud" wrote: Anthony, Although the code could put all the stuff in the sheet, you could also just make a sheet to use as a basis, and copy it when you need a new one. That way, when you change the layout (or formatting, or whatever) of the sheet, as you will, mark my words, you won't have to change a bunch of code. You could hide the sheet. Sub NewInvoice() Sheets("Invoice master").Visible = True Sheets("Invoice Master").Copy After:=ActiveSheet 'ActiveSheet.Name = Sheets("Invoice Master").Visible = False -- Earl Kiosterud www.smokeylake.com/ ------------------------------------------- "Anthony" wrote in message ... Hi, I am quite new to this so go easy !, I have the code (donted - thanks) below that will create a new worksheet with the name changed to some data input by the user. my question is it possible to 'format' parts of this worksheet ie show data in cell B13 as 'bold' and to add three 'heading's to 3 different cells. so by default I want the newly created worksheet to have the following 'standard' settings. cells D13:D17 and F13:F17 to be formatted to show values in £ cell D12 to show the word "PRICE" in bold size 12 cell B25 to be text size 20 in colour red and also bold. is this possible - if so how?? oh yes here is the code I have Sub NewSheet() Dim x As Worksheet Dim y As Worksheet Dim z As Variant Set x = ActiveSheet With Sheets.Add ActiveSheet.Name = x.Range("B2") Set y = ActiveSheet z = Array(x.Range("B2"), x.Range("B4") y.Range("B3") = z(0) 'NAME y.Range("D3") = z(1) 'BOOKING REF End With MsgBox "Thank You, Order Created Successfully !", vbInformation End Sub many many thanks |
All times are GMT +1. The time now is 06:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com