Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default if structure help

I have a sheet with 5,000 cells (a2:a5000) with numbers, and 5,000
cells(b2:b5000) with numbers, what I want to do is if a2 = b2 print "" and if
they are different (else) print the Date, as I cant print 5000 times the
folowing formula in VB:
If Worksheets("Sheet3").[A11] = Worksheets("Sheet3").[b11] Then
Worksheets("Sheet3").[c11] = "" Else Worksheets("Sheet3").[c11] = Date


I need an other way to do what I want, Do you have any idea????

regards

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default if structure help

Do you mean

WithWorksheets("Sheet3")
For i = 2 to 5000
If .Cells(i,"A").Value = .Cells(i,"B").Value Then
.Cells(i,"C").Value = ""
Else
.Cells(i,"C"). = Format(Date,"dd mmm yyyy")
End If
Next i
End WIth

--

HTH

RP
(remove nothere from the email address if mailing direct)


"filo666" wrote in message
...
I have a sheet with 5,000 cells (a2:a5000) with numbers, and 5,000
cells(b2:b5000) with numbers, what I want to do is if a2 = b2 print "" and

if
they are different (else) print the Date, as I cant print 5000 times the
folowing formula in VB:
If Worksheets("Sheet3").[A11] = Worksheets("Sheet3").[b11] Then
Worksheets("Sheet3").[c11] = "" Else Worksheets("Sheet3").[c11] = Date


I need an other way to do what I want, Do you have any idea????

regards



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default if structure help

That's exactly what I meant, your a genius, could you tell me where I can
learn more about VBA because im good in excel but I have a huge limit because
I dont know how to use VBA.¡¡¡

"Bob Phillips" wrote:

Do you mean

WithWorksheets("Sheet3")
For i = 2 to 5000
If .Cells(i,"A").Value = .Cells(i,"B").Value Then
.Cells(i,"C").Value = ""
Else
.Cells(i,"C"). = Format(Date,"dd mmm yyyy")
End If
Next i
End WIth

--

HTH

RP
(remove nothere from the email address if mailing direct)


"filo666" wrote in message
...
I have a sheet with 5,000 cells (a2:a5000) with numbers, and 5,000
cells(b2:b5000) with numbers, what I want to do is if a2 = b2 print "" and

if
they are different (else) print the Date, as I cant print 5000 times the
folowing formula in VB:
If Worksheets("Sheet3").[A11] = Worksheets("Sheet3").[b11] Then
Worksheets("Sheet3").[c11] = "" Else Worksheets("Sheet3").[c11] = Date


I need an other way to do what I want, Do you have any idea????

regards




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default if structure help

On Tue, 1 Mar 2005 11:59:08 -0800, "filo666"
wrote:

I have a sheet with 5,000 cells (a2:a5000) with numbers, and 5,000
cells(b2:b5000) with numbers, what I want to do is if a2 = b2 print "" and if
they are different (else) print the Date, as I cant print 5000 times the
folowing formula in VB:
If Worksheets("Sheet3").[A11] = Worksheets("Sheet3").[b11] Then
Worksheets("Sheet3").[c11] = "" Else Worksheets("Sheet3").[c11] = Date


I need an other way to do what I want, Do you have any idea????

regards


Perhaps:

===================
Sub foo()
Dim i As Integer

For i = 2 To 5000
If Worksheets("Sheet3").Cells(i, 1) = Worksheets("Sheet3").Cells(i, 2) Then
Worksheets("Sheet3").Cells(i, 3) = ""
Else
Worksheets("Sheet3").Cells(i, 3) = Date
End If
Next i
End Sub
===================


--ron
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default if structure help

Get John Walkenbach's VBA For Dummies book (it is just a generic name, it is
really traeting you as a dummy :-)), and work through it. And ask specific
questions here just as youy did and also study this group and see what
others are asking and others respond. Practice, practice, practice.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"filo666" wrote in message
...
That's exactly what I meant, your a genius, could you tell me where I can
learn more about VBA because im good in excel but I have a huge limit

because
I dont know how to use VBA.¡¡¡

"Bob Phillips" wrote:

Do you mean

WithWorksheets("Sheet3")
For i = 2 to 5000
If .Cells(i,"A").Value = .Cells(i,"B").Value Then
.Cells(i,"C").Value = ""
Else
.Cells(i,"C"). = Format(Date,"dd mmm yyyy")
End If
Next i
End WIth

--

HTH

RP
(remove nothere from the email address if mailing direct)


"filo666" wrote in message
...
I have a sheet with 5,000 cells (a2:a5000) with numbers, and 5,000
cells(b2:b5000) with numbers, what I want to do is if a2 = b2 print ""

and
if
they are different (else) print the Date, as I cant print 5000 times

the
folowing formula in VB:
If Worksheets("Sheet3").[A11] = Worksheets("Sheet3").[b11] Then
Worksheets("Sheet3").[c11] = "" Else Worksheets("Sheet3").[c11] = Date


I need an other way to do what I want, Do you have any idea????

regards






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
Help with formula structure Richard Excel Discussion (Misc queries) 4 October 7th 06 02:35 AM
Please help me... with Case Structure LSB M Excel Worksheet Functions 3 July 12th 06 09:31 AM
Wacky Little IF Structure nevi Excel Discussion (Misc queries) 3 June 24th 06 01:19 AM
Tree Structure ExcelMonkey[_190_] Excel Programming 4 February 25th 05 02:07 AM
Structure of If...Else in VBA John Wilson Excel Programming 2 July 30th 03 04:33 AM


All times are GMT +1. The time now is 01:52 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"