Input from a cell

Tags
Summary

Get input from a cell.

Situation

You want to get one data value from the user.

Needs

A cell in a worksheet.

Provides

A variable with a value.

Action

Use VBA's Cells function.

Explanation

Example 1

Provides a numeric value. Gets it from cell C2.

  • Dim sRate As Single
  • sRate = Cells(2, 3)

Example 2

Provides a string value. Gets it from cell D1

  • Dim tName As String
  • tName = Cells(1, 4)
Where referenced