Need help writing the VBA code: From this, you will need to learn VBA code to do
ID: 3875395 • Letter: N
Question
Need help writing the VBA code:
From this, you will need to learn VBA code to do the following: . Create a new worksheet and rename it . Change the Format of cells . Set a Name for a cell or range (Named Ranges) Unlock a cell Enter text (values) into a cell, formulas are the same but uses the Formula property .Copy and paste text . Remove the copy marquee (dotted lines) from a copied cell . Protect and unprotect a worksheet . Delete worksheets Further tips: Looking at your recorded macro, you will see lines such as: Range("A2").Select Activecell.FormulaR1C1"Looks Great!" In VBA code using a separate line to select an object first is not necessary, so in future assignments your code should look more like: Range("A2") .Value "Looks Great!Explanation / Answer
1.Create a new Worksheet and rename it
Dim WS As Worksheet
'Adding a new sheet
Set WS = Sheets.Add
'Setting the name of the sheet
Sheets.Add.Name = "Sheet Name"
2.Change the format of the cells
'Number formatting to general
Selection.NumberFormat = "# ?/?"
Selection.NumberFormat = "General"
Changing Font Format:
With Range("A1").Font
'font type (You can give name of font format )
.Name = "Arial"
'font style
.FontStyle = "Bold"
'font size
.Size = 9
3.Set Name for a Cell or Range
above code will change the name of cell A1 to AnyName
4.Unlock a Cell
Range("A1").Locked = False
'A1 is cell name
5.Adding text into cell
This code will write the value yourtext to cell A1.
'Set Formula
6.Copy and Paste
Range("B4").Copy Range("B6")
This code will copy the cell(B4) value and paste in cell B6 value.
7.Remove the copy marquee.
Application.CutCopyMode = False
8.Protect and unprotect worksheets
9.Delete worksheet
Sheets("SheetName").Delete
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.