Copy named range, but skip blanks

"Excel VBA Help"


Play Friv Now - Play Friv Games
Go Back   The Code Cage Forums > Microsoft Topics > Microsoft Excel Forum
Our Info Pages:-
The Code Cage - Microsoft Office help


Microsoft Excel Forum Members Post questions in this forum if they are related to using Microsoft Excel, this includes Worksheet Functions, Excel VBA Programming, Simple Macro Code & Charting, Excel formula etc.

New Reply
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
Unread 14th December 2009, 18:17
Munchkin's Avatar
Newsgroup Contributor
Posts: n/a
Posts Per Day: 0
My Top Tip Count:
Default Copy named range, but skip blanks
     Excel: VBA   

------ Register to get rid of these "In Post" ads! ------

Category: Excel: VBA   

My goal here is to copy "NewRecord" and paste values only in the first blank
cell in column A on the Payment History sheet, while skipping blanks rows.

"NewRecord" has 22 rows with formulas in columns A, B & C. Sometimes all 22
rows will have data entered, sometimes only the 1st row.

The marco works, but does not skip the blank rows in NewRecord - is it
because there are formulas present? How do I fix this?

Also, how do I assure my macro is pasting on the first blank row of column

Application.Goto Reference:="NewRecord"
Sheets("Payment History").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=True, Transpose:=False
End Sub

The Code Cage Advertisment
Unread 14th December 2009, 18:34
joel's Avatar
joel joel is offline
Expert Member
MS Office Version: MS Office 97
MS Office Skill Level: New to MS Office
Join Date: Apr 2009
Age: 61
Posts: 1,252
Posts Per Day: 0.41
My Top Tip Count: 0
Thanks to others: 0
Thanked 6 Times in 6 Posts
Reputation: 220 (23) joel has a spectacular aura aboutjoel has a spectacular aura aboutjoel has a spectacular aura about
Default Re: Copy named range, but skip blanks

------ Register to get rid of these "In Post" ads! ------

LastRow = Sheets("Payment History").Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1

NumberofRows = Range("NewRecord").Rows.Count

For RowCount = 1 To NumberofRows
If Range("NewRecord").Offset(RowCount - 1, 0) _
.Resize(1, 1).Value <> "" Then

Sheets("Payment History").Range("A" & NewRow).PasteSpecial _
NewRow = NewRow + 1
End If

Next RowCount

The Code Cage Advertisment

To stop seeing these ads and get other benefits check This page!

New Reply
The Code Cage at Facebookhe Code Cage at Twitter

blanks, copy, named, range, skip

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

The Code Cage Affilliates tested by McAfee Security tested by McAfee Security

All times are GMT +1. The time now is 21:31.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Template-Modifications by TMS
No part of this board, functionality or creatives may be copied or reproduced either in part or full without the express permission of The Code Cage Team.
Copyright ©2008 - , Simon lloyd.
We are not associated with nor employed by Microsoft in any way, we simply provide resources!
All MS office icons are registered trademarks of the application they represent and are used with permission from Microsoft
Cultural Forum | Study at Malaysian University