![]() |
trouble with syntax with fill down in Excel
Excel VBA
I am trying to 1) copy D25 and copy down where Column E data ends 2) Then Copy start in D25 through Column J where data ends And put into a new worksheet starting A1. D E F G H I J 25 2805 11111 11111 1111 1111 111 111 26 11111 11111 1111 1111 111 111 27 11111 11111 1111 1111 111 111 I am having trouble with syntax of the following piece of code. Now need to figure out Test Data right now is D25:J37 with D25 having on "2805" and D26 on down blank but when I run the code for some reason the "2805" in D25 is copying down to D61 and not stop in D37 Where Column E ends in E37. Can someone tell me why? AnPrivate Sub cmdTransferToSRP_Click() 'Copy Data and transfer to New Workbook Dim rngToCopy As Range Dim rngToPaste As Range Dim r r = Range("E65536").End(xlUp).Row Range("D25").Resize(r, 1).FillDown Set rngToCopy = Range("D25:J" & Cells(Rows.Count, "D").End(xlUp).Row y help would greatly be appreciated! -- ca1358 |
trouble with syntax with fill down in Excel
Cal,
Range("D25").Resize(r, 1).FillDown Should be: Range("D25:D" & r).FillDown and your copy problem will be fixed by that as well. HTH, Bernie MS Excel MVP "ca1358" wrote in message ... Excel VBA I am trying to 1) copy D25 and copy down where Column E data ends 2) Then Copy start in D25 through Column J where data ends And put into a new worksheet starting A1. D E F G H I J 25 2805 11111 11111 1111 1111 111 111 26 11111 11111 1111 1111 111 111 27 11111 11111 1111 1111 111 111 I am having trouble with syntax of the following piece of code. Now need to figure out Test Data right now is D25:J37 with D25 having on "2805" and D26 on down blank but when I run the code for some reason the "2805" in D25 is copying down to D61 and not stop in D37 Where Column E ends in E37. Can someone tell me why? AnPrivate Sub cmdTransferToSRP_Click() 'Copy Data and transfer to New Workbook Dim rngToCopy As Range Dim rngToPaste As Range Dim r r = Range("E65536").End(xlUp).Row Range("D25").Resize(r, 1).FillDown Set rngToCopy = Range("D25:J" & Cells(Rows.Count, "D").End(xlUp).Row y help would greatly be appreciated! -- ca1358 |
trouble with syntax with fill down in Excel
Thank you!!!!!!!
-- ca1358 "Bernie Deitrick" wrote: Cal, Range("D25").Resize(r, 1).FillDown Should be: Range("D25:D" & r).FillDown and your copy problem will be fixed by that as well. HTH, Bernie MS Excel MVP "ca1358" wrote in message ... Excel VBA I am trying to 1) copy D25 and copy down where Column E data ends 2) Then Copy start in D25 through Column J where data ends And put into a new worksheet starting A1. D E F G H I J 25 2805 11111 11111 1111 1111 111 111 26 11111 11111 1111 1111 111 111 27 11111 11111 1111 1111 111 111 I am having trouble with syntax of the following piece of code. Now need to figure out Test Data right now is D25:J37 with D25 having on "2805" and D26 on down blank but when I run the code for some reason the "2805" in D25 is copying down to D61 and not stop in D37 Where Column E ends in E37. Can someone tell me why? AnPrivate Sub cmdTransferToSRP_Click() 'Copy Data and transfer to New Workbook Dim rngToCopy As Range Dim rngToPaste As Range Dim r r = Range("E65536").End(xlUp).Row Range("D25").Resize(r, 1).FillDown Set rngToCopy = Range("D25:J" & Cells(Rows.Count, "D").End(xlUp).Row y help would greatly be appreciated! -- ca1358 |
trouble with syntax with fill down in Excel
You're quite welcome.... always happy to hear good news ;-)
Bernie MS Excel MVP Thank you!!!!!!! -- ca1358 |
All times are GMT +1. The time now is 04:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com