Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-16-2015, 09:13 AM
jrt jrt is offline Loop - Row increment Windows 7 32bit Loop - Row increment Office 2010 32bit
Novice
Loop - Row increment
 
Join Date: Nov 2014
Posts: 2
jrt is on a distinguished road
Default Loop - Row increment

Hi,

increment row number using variable
If the data is available in the rst, the result should add to the existing data and increase rows by pasting the result

Code works :
sheet lst values (column A) mapped with sheet checks value (column I) - IF MATCHED, range should be copied from A:O and the result should pasted in rst sheet name (as same copied without any changes).

If data available : find the last row and add to the existing data.

Below code working fine : up to pastespecial....

my request : increment row number using variable
If the data is available in the rst, the result should add to the existing data and increase rows by pasting the result.

Sub test3()
Dim x As Integer, y
Dim s As Integer, j
x = Sheets("lst").Range("a" & Rows.Count).End(xlUp).Row
s = Sheets("checks").Range("I" & Rows.Count).End(xlUp).Row
a = 1
For y = 1 To x
For j = 1 To s
If Sheets("lst").Cells(y, 1) = Sheets("checks").Cells(j, 9) Then
a = a + 1
Sheets("checks").Range("A" & j & ":O" & j).Copy
Sheets("rst").Range("A1").PasteSpecial
End If


Next j
Next y
End Sub

Thank You.
Reply With Quote
  #2  
Old 04-16-2015, 01:46 PM
Jhnsnkth527 Jhnsnkth527 is offline Loop - Row increment Windows 7 64bit Loop - Row increment Office 2010 64bit
Novice
 
Join Date: Apr 2015
Location: Cincinnati
Posts: 7
Jhnsnkth527 is on a distinguished road
Default

If I understand you code, it looks like you select a variable range to copy from "checks", but your PasteSpecial is to the same range "A1" every time. I'm guessing, the range should be Range("A" & a).
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Increment Numbers Darbsp Word 3 03-10-2015 05:25 AM
Loop - Row increment macro not working (on click increment) gsrikanth Excel Programming 1 07-12-2012 07:40 AM
Loop - Row increment on click increment gsrikanth Excel Programming 1 02-23-2012 08:19 AM
Increment Numbers Help Jazz43 Word 2 07-30-2010 02:48 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft