Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The first line of code works fine.
The commented out line to return "" produces error 400. Also, is it possible to do the "value = value" on the commented out code so there are no formulas in A1:A5, just the returned values? Thanks, Howard Option Explicit Sub X() Range("A1:A5").Formula = "=VLOOKUP(C1, $D$1:$F$5, 3, 0)" 'Formula here works in sheet but not by code 'Range("A1:A5").Formula = "=IF(VLOOKUP(C1,$D$1:$F$5,3,0)=0,"",(VLOOKUP(C1,$D $1:$F$5,3,0)))" End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Howard,
Try this: Sub X() With Range("A1:A5") .Formula = "=IF(VLOOKUP(C1,$D$1:$F$5,3,0)=0,"""", VLOOKUP(C1,$D$1:$F$5,3,0)))" .Value = .Value End With End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Tuesday, June 4, 2013 7:29:10 PM UTC-7, Ben McClave wrote:
Howard, Try this: Sub X() With Range("A1:A5") .Formula = "=IF(VLOOKUP(C1,$D$1:$F$5,3,0)=0,"""", VLOOKUP(C1,$D$1:$F$5,3,0)))" .Value = .Value End With End Sub Thanks, Ben. Works smack on, just had to add the missing "(". .Formula = "=IF(VLOOKUP(C1,$D$1:$F$5,3,0)=0,"""",(VLOOKUP(C1, $D$1:$F$5,3,0)))" Regards, Howard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display one sheet or two userforms while code is vba code is runningon another | Excel Programming | |||
Code to change code in a sheet and workbook module | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Code Only works when sheet is in focus | Excel Programming | |||
excel - macro code to open a protected sheet, enter passowrd, and then protect sheet | Excel Programming |