How to clear rows before copying data

  • Thread starter Thread starter steve1040
  • Start date Start date
S

steve1040

I have modified the following macro which I got from another posting.

2 questions
1. How do I clear all the data in UpdateListing starting at row 2?

2. In column A of UpdateListing I want the word "UPDATE" for each row.
Is it possible to add the word to V (the Array)?
I tried Array("UPDATE",3, 4, 5) but got an error


Public Sub createupdatelist()
Dim v As Variant, col As Long
v = Array(3, 4, 5) ' D, E, F
col = 2
Set rng = Range(Cells(2, 1), Cells(Rows.Count, 1).End(xlUp))
For i = LBound(v) To UBound(v)
rng.Offset(, v(i)).Copy Destination:= _
Worksheets("UpdateListing").Cells(2, col)

col = col + 1
Next
End Sub


Thanks
Steve
 
Use the below for clearing a range and updating cells

Range("A1:B10").Clear
Range("A1:B10") = "Update"

If this post helps click Yes
 
Back
Top