Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to clear rows before copying data
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to clear rows before copying data
Use the below for clearing a range and updating cells
Range("A1:B10").Clear Range("A1:B10") = "Update" If this post helps click Yes --------------- Jacob Skaria "steve1040" wrote: 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
need VBA to clear dependent data validation lists in several rows | Excel Programming | |||
Clear data and hide rows. | Excel Programming | |||
Clear entire rows below last row of data in col A except in 1st 3 sheets | Excel Programming | |||
Clear rows with no data? | Excel Programming | |||
Help to clear data & delete rows | Excel Programming |