Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default VBA - Copy/Paste to next empty cell

I would like to have a button that, when clicked, will copy the contents of a
specific row and paste it into the next empty row of several subsequent
ranges.

Example:

Range 1: B8:E12
Range 2: B20:E24
Range 3: B32:E36

There is text in B8 and a number in E8.

I would like to click a button that will paste the information in B8 and E8
to the first empty rows in Ranges 2 and 3 (could be B20/E20 of Range 1 and
B34/E34 of Range 2, and so on, depending on which row is empty in each range).
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default VBA - Copy/Paste to next empty cell

See if this is what you're after.

Sub CopyPasteTwoPlaces()
' Copies B8:E8 to B20:F31 and B32:F41 and beyond
Dim i As Long
Range("B8:E8").Copy
For i = 20 To 31 Step 1 '12 places for first paste values
If IsEmpty(Cells(i, 2).Value) Then Exit For
Next
Debug.Print i
Cells(i, 2).Select
ActiveSheet.Paste
If IsEmpty(Range("B32").Value) Then
Range("B32").Select
Else
Range("B" & Range("B:B").Rows.Count).End(xlUp).Offset(1, 0).Select
End If
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub


HTH
--
Data Hog


"megangomez" wrote:

I would like to have a button that, when clicked, will copy the contents of a
specific row and paste it into the next empty row of several subsequent
ranges.

Example:

Range 1: B8:E12
Range 2: B20:E24
Range 3: B32:E36

There is text in B8 and a number in E8.

I would like to click a button that will paste the information in B8 and E8
to the first empty rows in Ranges 2 and 3 (could be B20/E20 of Range 1 and
B34/E34 of Range 2, and so on, depending on which row is empty in each range).

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
empty cell / copy and paste Helmut Excel Programming 7 May 26th 09 01:11 PM
Find first empty cell in column J. Copy, paste special, value from zzxxcc Excel Programming 12 September 12th 07 10:34 PM
Copy & Paste to Last Empty Row ALATL Excel Programming 3 September 11th 07 04:50 PM
Copy and Paste in the first empty available line. Etienne Excel Programming 5 August 3rd 06 03:49 PM
macro to copy paste non empty data paritoshmehta[_22_] Excel Programming 0 July 1st 04 09:17 PM


All times are GMT +1. The time now is 07:40 PM.

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

About Us

"It's about Microsoft Excel"