Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2012, 02:47 PM
YounesB3 YounesB3 is offline Lastrow definition problem Windows XP Lastrow definition problem Office 2010 32bit
Advanced Beginner
Lastrow definition problem
 
Join Date: Jul 2012
Posts: 37
YounesB3 is on a distinguished road
Default Lastrow definition problem

Hello, so far, I've been using this to take into account all the data until the last non-blank data from a column:



Code:
LastRow2 = Range("Q" & Rows.Count).End(xlUp).Row
Range("V52").Select
Selection.AutoFill Destination:=Range("V52:V" & LastRow2)
Now, I'd like to define lastrow from a column to a specific value. For instance, all the data until the word "blank" comes up.

So if I had from V52:

a
b
c
d
e
f
g
blank
blank
blank

Last row would stop at "g". Is that possible?
Reply With Quote
  #2  
Old 09-26-2012, 10:08 PM
macropod's Avatar
macropod macropod is offline Lastrow definition problem Windows 7 64bit Lastrow definition problem Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The simplest approach in that case would be to use the Find function to find 'blank' in the column of interest, get it's row and deduct 1:
Code:
Dim LastRow As Long
LastRow = 0
On Error Resume Next
LastRow = ActiveSheet.Range("Q:Q").Rows.Find("blank").Row - 1
MsgBox LastRow
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Lastrow definition problem definition of work column ketanco Project 9 05-31-2012 05:15 PM
font in style definition trashed eNGiNe Word 1 03-30-2012 05:03 AM
Dumping styles definition gouletp Word 3 09-06-2011 10:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:19 AM.


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