KEMBAR78
1 To 10 Day VBA | PDF | Boolean Data Type | Computer Programming
0% found this document useful (0 votes)
21 views3 pages

1 To 10 Day VBA

Uploaded by

r1ujm3ik68
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

1 To 10 Day VBA

Uploaded by

r1ujm3ik68
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

DAY-4

Sub FormatSalesData()
Range("A1:C1").Select
Selection.Font.Bold = True
Range("A1:C5").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Range("A1:C1").Select
With Selection.Font
.Color = -1003520
.TintAndShade = 0
End With
End Sub

DAY-5
Sub rename_and_selectsheet()
Sheets(1).Name = "Q1"
Sheets(2).Name = "Q2"
Sheets(3).Name = "Q3"
Sheets("Q2").Select
End Sub
DAY-6
Sub modify_range()
Dim rg As Range
Set rg = ThisWorkbook.Sheets("Sheet1").Range("A1:C3")
rg.Name = "SalesData"
Range("B2").Value = 500
rg.Interior.Color = RGB(255, 255, 0)
End Sub

DAY-7
Sub offset_ex()
Dim scell, tcell As Range
Set scell = ThisWorkbook.Sheets("sheet1").Range("A1")
Set tcell = scell.Offset(2, 3)
tcell.Value = "Hello"
With tcell.Borders
.LineStyle = xlContinuous
.Color = RGB(0, 0, 0)
.TintAndShade = 0
.Weight = xlThin
End With
End Sub

DAY-8
Sub copy_col_AtoB()
ThisWorkbook.Sheets("Sheet1").Columns("A").Copy
ThisWorkbook.Sheets("Sheet2").Columns("B").PasteSpecial Paste:=xlPasteAll
Application.CutCopyMode = False
End Sub

DAY-9
Sub myvars()
Dim mynum As Integer
Dim myname As String
Dim mydate As Date
Dim istrue As Boolean
mynum = 48
myname = "Jack"
mydate = "11-8-2024"
istrue = True
MsgBox "Number=" & mynum
MsgBox "Name=" & myname
MsgBox "Date=" & mydate
MsgBox "Boolean= " & istrue
End Sub

DAY-10
Sub data_types()
Dim largenum As Long
Dim precisenum As Single
Dim veryprecisenum As Double
largenum = 768549320
precisenum = 786.984
veryprecisenum = 473.9532648
Dim longres As Long
Dim singleres As Single
Dim doubleres As Double
longres = largenum / 2
singleres = precisenum * 2
doubleres = veryprecisenum / 1.5
MsgBox "Result of long=" & longres
MsgBox "Result of single=" & singleres
MsgBox "Result of double=" & doubleres
End Sub

You might also like