Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need VBA to clear dependent data validation lists in several rows PerplexedPanda Excel Programming 4 May 9th 08 10:50 PM
Clear data and hide rows. SANTANDER Excel Programming 7 March 20th 08 09:52 AM
Clear entire rows below last row of data in col A except in 1st 3 sheets Max Excel Programming 6 January 7th 08 10:33 AM
Clear rows with no data? Kai Cunningham[_2_] Excel Programming 4 July 2nd 07 10:44 PM
Help to clear data & delete rows Eddy Stan Excel Programming 1 March 11th 06 10:29 AM


All times are GMT +1. The time now is 08:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"