LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default If statement question


It seems to me that Bob gave you a good start, but if I am reading what
you are asking right, I thing the code might be more like this:


Code:
--------------------
If TFL1 = "" Then
'do nothing
Else
'insert the code for whatever it is you want it to do if there is something.
--------------------


Of course I am a little unclear as to what you are actually trying to
accomplish, but then again that is not uncommon around here.

I don't know if that will help you at all, but whenever I am using an
IF statement in code, and one of the options of the if is when I want
it to do nothing, I just stick in the comment line " 'do nothing"
instead of trying to code for contingencies I can't even possibly guess
at.

Here's to hope, and take care,
Amber :)

Bob Phillips Wrote:
Does this not work?


If TFL1 = "" Then
.Cells(3, 115).Value = Range("GL19").Value
Else
.Cells(12,63).Value = Range("BK12").Value
End If

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"dlb" wrote in
message
...

I am making a macro to copy data from a cell in one workbook and

pasting
it into another workbook. Unfortunatly I don't know VB too well,

I'm
more use to writing formulas in excel cells.

I'm trying to write an IF, THEN, ELSE statement in which the program
will not display a cells contents if there is nothing to display

(blank
cell). I do most of my programs in excel rather than VB. This is

what
I would put in excel to do what im looking to do: If(A1="","",A1).
How do I go about doing that in VB? Here is what I have so far, I'm
just working around it by telling the program to display the results

in
a different cell, but its not working as planned, and I need the

program
to just not display the info anywhere.

Dim NTHNG As String
Dim TFR1 As String

NTHNG = Range("GL19").Value
TFL1 = Range("BK12").Value

If TFL1 = "" Then .Cells(3, 115).Value = NTHNG Else .Cells(12,
63).Value = TFL1

Any help would be appreciated

Dan


--
dlb

------------------------------------------------------------------------
dlb's Profile:

http://www.excelforum.com/member.php...o&userid=16483
View this thread:

http://www.excelforum.com/showthread...hreadid=512432



--
Amber_D_Laws
------------------------------------------------------------------------
Amber_D_Laws's Profile: http://www.excelforum.com/member.php...o&userid=30012
View this thread: http://www.excelforum.com/showthread...hreadid=512432

 
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 Statement question peg84 Excel Discussion (Misc queries) 3 February 4th 08 10:19 PM
IF statement question [email protected] Excel Worksheet Functions 2 July 24th 06 04:20 PM
IF then statement question ChuckW Excel Discussion (Misc queries) 2 February 24th 06 04:30 PM
Question about dim statement Gregg[_4_] Excel Programming 4 July 19th 05 03:07 PM
If Statement Question carl Excel Worksheet Functions 1 March 11th 05 04:55 AM


All times are GMT +1. The time now is 11:53 PM.

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

About Us

"It's about Microsoft Excel"