Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF Statement question | Excel Discussion (Misc queries) | |||
IF statement question | Excel Worksheet Functions | |||
IF then statement question | Excel Discussion (Misc queries) | |||
Question about dim statement | Excel Programming | |||
If Statement Question | Excel Worksheet Functions |