Techoug Nzin
Techoug Nzin

Reputation: 13

VBA how to Clear the content of an unknown Range?

The casual method is Sheet.Range("A3:C3").clearcontents For example.

For my program, the number 3 comes from somewhere else, lets say Inputbox.

Dim Index As Integer

Index = Inputbox.....value

Sheet.Range("A Index : "C Index).clearcontents         'Dont work

so i dont know what value Index is going to get yet, how can clear with a Range then?

Later i want to copy that range and paste it some where else with Range.

do you have an alternative, should i use Cells( Index, 1).clear

Thank you.

Upvotes: 0

Views: 1303

Answers (1)

Ricardo Eguia
Ricardo Eguia

Reputation: 101

sheet.Range("A" & index & ":C" & index).ClearContents

Upvotes: 1

Related Questions