IP 244 VBA

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/12

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:06 PM on 9/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

13 Terms

1
New cards

.xlsm

  • Save as .xlsm

  • Otherwise VBA code will be deleted


2
New cards

Creating module & comments

  • Insert > Module

  • Use ‘ at start of line to make entire line comment


3
New cards

Sub

  • eg. Sub worksheet_VBA()

  • Block of code that doesn’t return value.


4
New cards

Sheet naming

  • Excel format: Sheet1, Sheet2, ect. (use this referencing)

  • When renamed: Sheets(“Sheet name”)

  • Excel format stays constant but if renamed format used & a sheet is renamed then VBA code needs to be updated


5
New cards

Cells & Ranges

  • eg. Sheet1.Cells(2, 1).Value = 20

    • row, column

  • eg. Sheet1.Range(“B4:C12”).Clear


6
New cards

Active sheet

  • Code executed on current active sheet AKA sheet currently open in excel


7
New cards

Worksheet functions

  • Excel functions in VBA

  • eg. Sheet3.Range(“F2”).Value = WorksheetFunction.Average(Sheet3.Range(“A2:A200”))


8
New cards

Generate random variable from normal distribution

  • Sheet3.Range("G2").Value = WorksheetFunction.NormInv(Rnd, 5, 1.5)

  • Within min&max: Sheet3.Range("H2").Value = WorksheetFunction.RandBetween(Sheet3.Range("E2").Value, Sheet3.Range("F2").Value)

  • NormInv(probability; mean; standard deviation) - normal distribution inverse


9
New cards

Count If

  • Sheet3.Range("D2").Value = WorksheetFunction.CountIf(Sheet3.Range("A2:A200"), ">5")


10
New cards

Interior colour

  • Sheet3.Range("C2:H2").Cells.Interior.Color = vbYellow


11
New cards

Declaring variables

  • Dim variable_name As Double

  • double, integer,


12
New cards

Assign value, cell or user input to variable

  • variable_name = 7.5

  • Sheet1.Range(“D7”) = variable_name

  • variable_name = Sheet1.Range(“D7”)


13
New cards

Function condition specified by variable

  • Sheet3.Range("D2").Value = WorksheetFunction.CountIf(Sheet3.Range("A2:A200"), ">" & n_temp_threshold)