2 questions, 1 easy about "" in VB, 1 very difficult

F

filo666

1.
I want to do the following:
sub fdljsdf()
bla bla bla

a = Target.Address
b = Right(Left(a, 2), 1)
u = Range(a).Row
If b = "I" Then
Range("J" & u).Formula = "=I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0)"
End If
more bla bla bla
end sub

the question is:
If I want to change the formula so if there is no value in I & U output ""
the formula should look this way:

Range("J" & u).Formula = "=if(I" & u & "<>"",I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0),"")"

This difficult formula means, if for example, the user tryng to change cell
I6 then:
If cell I6<>"" then cell I6/(a value in registros that should be founded)
else print "".

the problem is that VB misunderstanding the "" before the <> and the ""
after the ,
how to explain VB that those "" are from the formula and aren't indicating
that they're text separators in the formula

please help me, this is driving me crazy.......


NOW THE OTHER ONE

2.
Hi, I'm tryng to accomplish something difficult to explain:
If you open a workbook (ex. hello.xls) and the you go to file-->open another
file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same
excel window, but if you open hello.xls ant then you go to the excels general
icon (the one that opens an excel window with a new woorkbook on it) ant
then you choose file-->open hello2.xls then you have 2 excel windows, now my
problem: I have my firs book hello.xls with all the menu bars disabled but
the woorkbook hello2.xls needs all the menu bars enabled so if I open my
workbook as explained on the second way to open the file I can have my file
hello.xls without the menu bars and hello2.xls with all the menu bars
enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I
cant paste a shortcut in the desktop because when I open the second file, it
opens in the excels window of my first file.
It's very important that the user of my program could open the file from the
desktop, so there is a way to do what I want?????
If you want to see an example of what I mean firts open a excel file (any)
and then go to Iexplorer browser and choose the export data to excel
(pressindg the right button of your mouse and choosing the option mentioned),
as you can see not just a new workbook has been opened but a entire excel new
window (with his own workbook)
Hope this have sence, TIA

ALSO AS ENGLISH IS NOT MY FIRST LENGUAGE COULD YOU TELL ME HOW THE "" ARE
NAMED PLEASE
TIA
 
J

JNW

to answer your second question:

In Hello.xls use the workbook_activate and workbook_deactivate eventsto
toggle the menu usage. You probably already have something in place to hide
and unhide the menus in the _open and _beforeclose events. All you need to
do is reference that. I've done something similar where I have a macro in a
regular module called HideMenus and another called ShowMenus. I call
HideMenus in the _activate and _open events, and I call ShowMenus in the
_deactivate and _beforeclose events.


filo666 said:
1.
I want to do the following:
sub fdljsdf()
bla bla bla

a = Target.Address
b = Right(Left(a, 2), 1)
u = Range(a).Row
If b = "I" Then
Range("J" & u).Formula = "=I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0)"
End If
more bla bla bla
end sub

the question is:
If I want to change the formula so if there is no value in I & U output ""
the formula should look this way:

Range("J" & u).Formula = "=if(I" & u & "<>"",I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0),"")"

This difficult formula means, if for example, the user tryng to change cell
I6 then:
If cell I6<>"" then cell I6/(a value in registros that should be founded)
else print "".

the problem is that VB misunderstanding the "" before the <> and the ""
after the ,
how to explain VB that those "" are from the formula and aren't indicating
that they're text separators in the formula

please help me, this is driving me crazy.......


NOW THE OTHER ONE

2.
Hi, I'm tryng to accomplish something difficult to explain:
If you open a workbook (ex. hello.xls) and the you go to file-->open another
file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same
excel window, but if you open hello.xls ant then you go to the excels general
icon (the one that opens an excel window with a new woorkbook on it) ant
then you choose file-->open hello2.xls then you have 2 excel windows, now my
problem: I have my firs book hello.xls with all the menu bars disabled but
the woorkbook hello2.xls needs all the menu bars enabled so if I open my
workbook as explained on the second way to open the file I can have my file
hello.xls without the menu bars and hello2.xls with all the menu bars
enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I
cant paste a shortcut in the desktop because when I open the second file, it
opens in the excels window of my first file.
It's very important that the user of my program could open the file from the
desktop, so there is a way to do what I want?????
If you want to see an example of what I mean firts open a excel file (any)
and then go to Iexplorer browser and choose the export data to excel
(pressindg the right button of your mouse and choosing the option mentioned),
as you can see not just a new workbook has been opened but a entire excel new
window (with his own workbook)
Hope this have sence, TIA

ALSO AS ENGLISH IS NOT MY FIRST LENGUAGE COULD YOU TELL ME HOW THE "" ARE
NAMED PLEASE
TIA
 
B

Bob Phillips

Try this

Range("J" & u).Formula = "=if(I" & u & "<>"""",I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0
),"""")"


--

HTH

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


filo666 said:
1.
I want to do the following:
sub fdljsdf()
bla bla bla

a = Target.Address
b = Right(Left(a, 2), 1)
u = Range(a).Row
If b = "I" Then
Range("J" & u).Formula = "=I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0
)"
End If
more bla bla bla
end sub

the question is:
If I want to change the formula so if there is no value in I & U output ""
the formula should look this way:

Range("J" & u).Formula = "=if(I" & u & "<>"",I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0
),"")"

This difficult formula means, if for example, the user tryng to change cell
I6 then:
If cell I6<>"" then cell I6/(a value in registros that should be founded)
else print "".

the problem is that VB misunderstanding the "" before the <> and the ""
after the ,
how to explain VB that those "" are from the formula and aren't indicating
that they're text separators in the formula

please help me, this is driving me crazy.......


NOW THE OTHER ONE

2.
Hi, I'm tryng to accomplish something difficult to explain:
If you open a workbook (ex. hello.xls) and the you go to file-->open another
file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same
excel window, but if you open hello.xls ant then you go to the excels general
icon (the one that opens an excel window with a new woorkbook on it) ant
then you choose file-->open hello2.xls then you have 2 excel windows, now my
problem: I have my firs book hello.xls with all the menu bars disabled but
the woorkbook hello2.xls needs all the menu bars enabled so if I open my
workbook as explained on the second way to open the file I can have my file
hello.xls without the menu bars and hello2.xls with all the menu bars
enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I
cant paste a shortcut in the desktop because when I open the second file, it
opens in the excels window of my first file.
It's very important that the user of my program could open the file from the
desktop, so there is a way to do what I want?????
If you want to see an example of what I mean firts open a excel file (any)
and then go to Iexplorer browser and choose the export data to excel
(pressindg the right button of your mouse and choosing the option mentioned),
as you can see not just a new workbook has been opened but a entire excel new
window (with his own workbook)
Hope this have sence, TIA

ALSO AS ENGLISH IS NOT MY FIRST LENGUAGE COULD YOU TELL ME HOW THE "" ARE
NAMED PLEASE
TIA
 
J

JNW

You know, you've already had this question answered a number of times. If
this doesn't work, please ask for more of an explanation, but don't cut and
paste the same question over and over (at least 7 times according to my
count). Tell us what part of the answer is giving you problems and we'll
work that part.



JNW said:
to answer your second question:

In Hello.xls use the workbook_activate and workbook_deactivate eventsto
toggle the menu usage. You probably already have something in place to hide
and unhide the menus in the _open and _beforeclose events. All you need to
do is reference that. I've done something similar where I have a macro in a
regular module called HideMenus and another called ShowMenus. I call
HideMenus in the _activate and _open events, and I call ShowMenus in the
_deactivate and _beforeclose events.


filo666 said:
1.
I want to do the following:
sub fdljsdf()
bla bla bla

a = Target.Address
b = Right(Left(a, 2), 1)
u = Range(a).Row
If b = "I" Then
Range("J" & u).Formula = "=I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0)"
End If
more bla bla bla
end sub

the question is:
If I want to change the formula so if there is no value in I & U output ""
the formula should look this way:

Range("J" & u).Formula = "=if(I" & u & "<>"",I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0),"")"

This difficult formula means, if for example, the user tryng to change cell
I6 then:
If cell I6<>"" then cell I6/(a value in registros that should be founded)
else print "".

the problem is that VB misunderstanding the "" before the <> and the ""
after the ,
how to explain VB that those "" are from the formula and aren't indicating
that they're text separators in the formula

please help me, this is driving me crazy.......


NOW THE OTHER ONE

2.
Hi, I'm tryng to accomplish something difficult to explain:
If you open a workbook (ex. hello.xls) and the you go to file-->open another
file (ex. hello2.xls) then you have hello.xls and hello2.xls in the same
excel window, but if you open hello.xls ant then you go to the excels general
icon (the one that opens an excel window with a new woorkbook on it) ant
then you choose file-->open hello2.xls then you have 2 excel windows, now my
problem: I have my firs book hello.xls with all the menu bars disabled but
the woorkbook hello2.xls needs all the menu bars enabled so if I open my
workbook as explained on the second way to open the file I can have my file
hello.xls without the menu bars and hello2.xls with all the menu bars
enabled; BUT I NEED TO OPEN EXCELS GENERAL ICON TO ACHIVE THIS, I mean, I
cant paste a shortcut in the desktop because when I open the second file, it
opens in the excels window of my first file.
It's very important that the user of my program could open the file from the
desktop, so there is a way to do what I want?????
If you want to see an example of what I mean firts open a excel file (any)
and then go to Iexplorer browser and choose the export data to excel
(pressindg the right button of your mouse and choosing the option mentioned),
as you can see not just a new workbook has been opened but a entire excel new
window (with his own workbook)
Hope this have sence, TIA

ALSO AS ENGLISH IS NOT MY FIRST LENGUAGE COULD YOU TELL ME HOW THE "" ARE
NAMED PLEASE
TIA
 
T

Toppers

Hi,

For 1, try:

Range("J" & u).Formula = "=IF(I" & u & "<>"""",I" & u &
"/Vlookup(E6,[Registros.xls]Inventario!A:CA,[Registros.xls]Inventario!$C$3,0),"""")"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top