Re: $$Excel-Macros$$ Run time error '1004' Method "Range " of oblect '_Globle fails

2014-01-02 Thread Paul Schreiner
I'm not sure what the purpose of your macro is.
 
It LOOKS like ComboBox1 has: "CAP, CREAM, DROP".
You're trying to select from one of these values in the combobox
and load another list (pre_Med_Name_1)
 
But there's a couple of things wrong with this approach.
First, the Range() object only has a .Value if the range is a single cell.
Otherwise, it's an array of values in .Value2
Like:

for inx = 1 to ubound(Range("CAP").Value2)
debug.print Range("CAP").Value2(inx,1)
next inx


Next, from your samples, CAP, CREAM and DROP are single-dimension arrays.
>From the "help" for .List,
.List can be used to load a combobox or listbox if loading multi-dimensional 
arrays:

Paul
-
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-



>
> From: Rupesh Patil 
>To: excel-macros@googlegroups.com 
>Sent: Thursday, January 2, 2014 3:07 AM
>Subject: $$Excel-Macros$$ Run time error '1004' Method "Range " of oblect 
>'_Globle fails
>  
>Hi expert 
>
>
>Please look below code and tell me why I am getting this error(Mentions in 
>subject line)
> Private Sub ComboBox1_Click()
>    Select Case ComboBox1 
>    Case "CAP"
>        pre_Med_Name_1.List = Range("CAP").Value 
>
>
>    Case "CREAM"
>        pre_Med_Name_1.List = Range("CREAM").Value
>
>
>    Case "DROP"
>        pre_Med_Name_1.List = Range("DROP").Value 
>
>
>    End Select
>    
>    With pre_Med_Name_1
>        .SetFocus 
>        Application.SendKeys ("%{DOWN}")
>    End With 
>End Sub
>
>
>Private Sub UserForm_Initialize() 
>    Dim sht1 As Worksheet
>    Set sht1 = ThisWorkbook.Sheets("Res_Do_not_Change") 
>   
>    ComboBox1.List = Application.Transpose(sht1.Range("A1") _ 
>                                           .CurrentRegion.Rows(1).Value)
>                                            
>    
>End Sub
>
>
>
>
>
>
>My Excel File structure is 
>
>
>    A                       B           C 
>   
>1  CAP  CREAM  DROP   
>2  Ibubid TR  Ciplox   Crocin    
>3  Inflapen CR   Acivir    Crocin Paed   
>4  Artincerin   Okavir  Pacimol   
>5  Diasol   Cyclovir  Oxalgin   
>
>
>Please help me on this. Actually I am doing this for dependent combo box  
>
>
>if I am doing it wrong way then please give me suggestion code  
>
>
>Thanks in advance  
-- 
>Thanks and Regards, Rp. 
-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel   
FORUM RULES 
  
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered. 
2) Don't post a question in the thread of another member. 
3) Don't post questions regarding breaking or bypassing any security measure. 
4) Acknowledge the responses you receive, good or bad. 
5) Jobs posting is not allowed. 
6) Sharing copyrighted material and their links is not allowed. 
  
NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss. 
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com. 
To post to this group, send email to excel-macros@googlegroups.com. 
Visit this group at http://groups.google.com/group/excel-macros. 
For more options, visit https://groups.google.com/groups/opt_out. 

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not 

Re: $$Excel-Macros$$ Run time error '1004' Method "Range " of oblect '_Globle fails

2014-01-02 Thread Anil Gawli
Dear Rupesh,

Kindly share the workbook with us.


Warm Regards,
Gawli Anil


On Thu, Jan 2, 2014 at 1:37 PM, Rupesh Patil wrote:

> Hi expert
>
> Please look below code and tell me why I am getting this error(Mentions in
> subject line)
>  Private Sub ComboBox1_Click()
> Select Case ComboBox1
> Case "CAP"
> pre_Med_Name_1.List = Range("CAP").Value
>
> Case "CREAM"
> pre_Med_Name_1.List = Range("CREAM").Value
>
> Case "DROP"
> pre_Med_Name_1.List = Range("DROP").Value
>
> End Select
>
> With pre_Med_Name_1
> .SetFocus
> Application.SendKeys ("%{DOWN}")
> End With
> End Sub
>
> Private Sub UserForm_Initialize()
> Dim sht1 As Worksheet
> Set sht1 = ThisWorkbook.Sheets("Res_Do_not_Change")
>
> ComboBox1.List = Application.Transpose(sht1.Range("A1") _
>.CurrentRegion.Rows(1).Value)
>
>
> End Sub
>
>
>
> My Excel File structure is
>
> A   B   C
>1  CAP CREAM DROP  2  Ibubid TR Ciplox  Crocin   3  Inflapen CR
> Acivir   Crocin Paed  4  Artincerin  Okavir Pacimol  5  Diasol  Cyclovir
> Oxalgin
>
> Please help me on this. Actually I am doing this for dependent combo box
>
> if I am doing it wrong way then please give me suggestion code
>
> Thanks in advance
>
>
> --
> Thanks and Regards, Rp.
>
> --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to excel-macros+unsubscr...@googlegroups.com.
> To post to this group, send email to excel-macros@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


$$Excel-Macros$$ Run time error '1004' Method "Range " of oblect '_Globle fails

2014-01-02 Thread Rupesh Patil
Hi expert

Please look below code and tell me why I am getting this error(Mentions in
subject line)
 Private Sub ComboBox1_Click()
Select Case ComboBox1
Case "CAP"
pre_Med_Name_1.List = Range("CAP").Value

Case "CREAM"
pre_Med_Name_1.List = Range("CREAM").Value

Case "DROP"
pre_Med_Name_1.List = Range("DROP").Value

End Select

With pre_Med_Name_1
.SetFocus
Application.SendKeys ("%{DOWN}")
End With
End Sub

Private Sub UserForm_Initialize()
Dim sht1 As Worksheet
Set sht1 = ThisWorkbook.Sheets("Res_Do_not_Change")

ComboBox1.List = Application.Transpose(sht1.Range("A1") _
   .CurrentRegion.Rows(1).Value)


End Sub



My Excel File structure is

A   B   C
  1  CAP CREAM DROP  2  Ibubid TR Ciplox  Crocin   3  Inflapen CR
Acivir   Crocin
Paed  4  Artincerin  Okavir Pacimol  5  Diasol  Cyclovir Oxalgin

Please help me on this. Actually I am doing this for dependent combo box

if I am doing it wrong way then please give me suggestion code

Thanks in advance


-- 
Thanks and Regards, Rp.

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.