Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default If cell equals anything then

I am trying to write a macro that pulls date from one sheet and puts
it into another sheet which I am going to e-mail. I only want the
cells that have information in them. Can someone help me?

This is what I am trying

For cnt = 7 To lrow2
If wsmiss102.Range("b" & cnt) = xlValue Then _


wsmiss102.Rows(cnt).Copy
ThisWorkbook.Sheets("Misses").Rows(x).PasteSpecial


x = x + 1
End If
Next

I am getting nothing copied over. But this is what I have in the third
row.
6021427993 BLAYLOCK 1-20 Bad X-Record
Length Thu Sep 06 04:00:35
I know it has something to do with xlvalue but I don't know what to
replace it with.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default If cell equals anything then

Try this:

For cnt = 7 To lrow2
If wsmiss102.Range("b" & cnt) < "" Then _
wsmiss102.Rows(cnt).Copy
ThisWorkbook.Sheets("Misses").Rows(x).PasteSpecial Paste:=xlValues
cnt = cnt + 1
End If

"bpotter" wrote:

I am trying to write a macro that pulls date from one sheet and puts
it into another sheet which I am going to e-mail. I only want the
cells that have information in them. Can someone help me?

This is what I am trying

For cnt = 7 To lrow2
If wsmiss102.Range("b" & cnt) = xlValue Then _


wsmiss102.Rows(cnt).Copy
ThisWorkbook.Sheets("Misses").Rows(x).PasteSpecial


x = x + 1
End If
Next

I am getting nothing copied over. But this is what I have in the third
row.
6021427993 BLAYLOCK 1-20 Bad X-Record
Length Thu Sep 06 04:00:35
I know it has something to do with xlvalue but I don't know what to
replace it with.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default If cell equals anything then

No that doesn't work. It collects all of the empty rows not the rows
that have values.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default If cell equals anything then

This line

If wsmiss102.Range("b" & cnt) < "" Then _

should prevent any empty lines from being copied. Is says if the specified
range is not equal to null then ... do something. So the only cells it will
acknowledge are those with data in them.

"bpotter" wrote:

No that doesn't work. It collects all of the empty rows not the rows
that have values.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
If a cell equals _, at the next row that equals _, return value fr CathyH Excel Worksheet Functions 10 May 2nd 07 07:53 PM
If cell is left blank, or equals zero, then cell equals a different cell John McMurry Excel Discussion (Misc queries) 3 April 13th 07 01:14 PM
How to create/run "cell A equals Cell B put Cell C info in Cell D abmb161 Excel Discussion (Misc queries) 5 January 26th 06 06:36 PM
if a:a (range) equals january and c:c equals gas then add g:g ($) BCOz Excel Worksheet Functions 4 December 29th 05 07:40 PM
custom filter does not work when selecting 'equals' X AND 'equals' plindman Excel Discussion (Misc queries) 1 June 1st 05 11:29 PM


All times are GMT +1. The time now is 12:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"