Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-09-2020, 08:22 PM
Guessed's Avatar
Guessed Guessed is offline Need Help with this Macro-Partially Working Windows 10 Need Help with this Macro-Partially Working Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I'm not sure why it would stop running but it might be because you are comparing a range with a number. Also, I would copy the row to a the first cell rather than to an entire row. Try this
Code:
Sub Transfer_Summary_Detail()
  Dim c As Range, j As Integer
  Dim Source As Worksheet, Target As Worksheet

  Set Source = ActiveWorkbook.Worksheets("Summary")  ' Change worksheet designations as needed
  Set Target = ActiveWorkbook.Worksheets("Sheet1")
  
  j = 4     ' Start copying to 4th row in target sheet
  For Each c In Source.Range("P4:P4000")   ' Do 4000 rows
    If c.Value <> 0 Then
      Source.Rows(c.Row).Copy Target.Range("A" & j)
      j = j + 1
    End If
  Next c
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with this Macro-Partially Working Deleting rows with partially redundant data Noah14 Excel Programming 1 09-19-2014 11:46 PM
Need Help with this Macro-Partially Working partially delete agenda items Gerreth Outlook 3 03-13-2012 05:06 AM
Partially Obscure Video in PowerPoint KBsay PowerPoint 0 10-05-2010 12:49 PM
Problems working in a partially protected document Autumn Excel 0 02-11-2009 03:46 PM
Drawing partially off printed page DLRA Visio 0 09-26-2006 10:40 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:19 PM.


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