Re: $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving same error

2011-07-25 Thread Jorge Marques
Doing that, it doesn´t return the error anymore, but the macro still doesn´t
copy the information :s, is it any complication with excel 2010?

2011/7/22 Rajan_Verma rajanverma1...@gmail.com

  *Set Wb=ActiveWorkbook*

 * *

 *From:* excel-macros@googlegroups.com [mailto:
 excel-macros@googlegroups.com] *On Behalf Of *Jorge Marques
 *Sent:* Thursday, July 21, 2011 10:44 PM
 *To:* excel-macros@googlegroups.com
 *Subject:* $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving
 same error

 ** **

 Hi guys, i have this macro i use to copy a range from column D of a
 worksheet of a workbook to column G of another workbook and worksheet, but
 it keeps giving me the same error saying that it´s subscript out of range
 in the line in yellow.

  

 Public wb, wbmes As Workbook

 Sub filldatabase()

 Call AbrirFile
 Call left

 wbmes.Close

 End Sub

 Private Sub AbrirFile()

 Dim Filter, Caption As String
 Dim SelectedFile As Variant

 Set wb = ThisWorkbook


 Filter = Ficheiro XLS (*.xls),(*.xls)
 Caption = Escolha o ficheiro a importar...

 SelectedFile = Application.GetOpenFilename(Filter, , Caption)

 If SelectedFile = False Then Exit Sub

 Set wbmes = Workbooks.Open(SelectedFile, 1, 1)

 End Sub


 Private Sub left()

 Dim a As Double

 wbmes.Activate
 wbmes.Sheets(Total_Refrige).Select
 wbmes.Sheets(Total_Refrige).Range(Range(D2),
 Range(D2).End(xlDown)).Copy
 wb.Activate

 If wb.Sheets(Pivot).Range(G2).Value   Then
 wb.Sheets(Pivot).Range(G1).End(xlDown).Offset(1, 0).Select
 Else
 wb.Sheets(Pivot).Range(G2).Select
 End If

 a = ActiveCell.Row

 wb.Sheets(Total Refrige).Paste 

 Application.CutCopyMode = False

 i = a

 While wb.Sheets(Pivot).Range(G  i).Value  
 i = i + 1

 Wend

 End Sub

  

 Do you have any idea how to solve this?1000 thanks

 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel

 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


-- 
--
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com


Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel


RE: $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving same error

2011-07-22 Thread Rajan_Verma
Set Wb=ActiveWorkbook

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Jorge Marques
Sent: Thursday, July 21, 2011 10:44 PM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving same
error

 

Hi guys, i have this macro i use to copy a range from column D of a
worksheet of a workbook to column G of another workbook and worksheet, but
it keeps giving me the same error saying that it´s subscript out of range
in the line in yellow.

 

Public wb, wbmes As Workbook

Sub filldatabase()

Call AbrirFile
Call left

wbmes.Close

End Sub

Private Sub AbrirFile()

Dim Filter, Caption As String
Dim SelectedFile As Variant

Set wb = ThisWorkbook


Filter = Ficheiro XLS (*.xls),(*.xls)
Caption = Escolha o ficheiro a importar...

SelectedFile = Application.GetOpenFilename(Filter, , Caption)

If SelectedFile = False Then Exit Sub

Set wbmes = Workbooks.Open(SelectedFile, 1, 1)

End Sub


Private Sub left()

Dim a As Double

wbmes.Activate
wbmes.Sheets(Total_Refrige).Select
wbmes.Sheets(Total_Refrige).Range(Range(D2),
Range(D2).End(xlDown)).Copy
wb.Activate

If wb.Sheets(Pivot).Range(G2).Value   Then
wb.Sheets(Pivot).Range(G1).End(xlDown).Offset(1, 0).Select
Else
wb.Sheets(Pivot).Range(G2).Select
End If

a = ActiveCell.Row

wb.Sheets(Total Refrige).Paste 

Application.CutCopyMode = False

i = a

While wb.Sheets(Pivot).Range(G  i).Value  
i = i + 1

Wend

End Sub

 

Do you have any idea how to solve this?1000 thanks

-- 

--
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links :
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

To post to this group, send email to excel-macros@googlegroups.com
 

Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

-- 
--
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com


Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel


Re: $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving same error

2011-07-21 Thread Anish Shrivastava
Please check if the sheet name is Pivot.
if not then rename it to Pivot.
On Thu, Jul 21, 2011 at 10:44 PM, Jorge Marques leote.w...@gmail.comwrote:

 Hi guys, i have this macro i use to copy a range from column D of a
 worksheet of a workbook to column G of another workbook and worksheet, but
 it keeps giving me the same error saying that it´s subscript out of range
 in the line in yellow.

 Public wb, wbmes As Workbook
 Sub filldatabase()
 Call AbrirFile
 Call left
 wbmes.Close
 End Sub
 Private Sub AbrirFile()
 Dim Filter, Caption As String
 Dim SelectedFile As Variant
 Set wb = ThisWorkbook

 Filter = Ficheiro XLS (*.xls),(*.xls)
 Caption = Escolha o ficheiro a importar...
 SelectedFile = Application.GetOpenFilename(Filter, , Caption)
 If SelectedFile = False Then Exit Sub
 Set wbmes = Workbooks.Open(SelectedFile, 1, 1)
 End Sub

 Private Sub left()
 Dim a As Double
 wbmes.Activate
 wbmes.Sheets(Total_Refrige).Select
 wbmes.Sheets(Total_Refrige).Range(Range(D2),
 Range(D2).End(xlDown)).Copy
 wb.Activate
 If wb.Sheets(Pivot).Range(G2).Value   Then
 wb.Sheets(Pivot).Range(G1).End(xlDown).Offset(1, 0).Select
 Else
 wb.Sheets(Pivot).Range(G2).Select
 End If
 a = ActiveCell.Row
 wb.Sheets(Total Refrige).Paste
 Application.CutCopyMode = False
 i = a
 While wb.Sheets(Pivot).Range(G  i).Value  
 i = i + 1

 Wend
 End Sub

 Do you have any idea how to solve this?1000 thanks

 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


-- 
--
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com


Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel


Re: $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving same error

2011-07-21 Thread Jorge Marques
Yes, the names are all ok, i double checked it, even try to change names,
but doesn´t work :S

2011/7/21 Anish Shrivastava anish@gmail.com

 Please check if the sheet name is Pivot.
 if not then rename it to Pivot.
   On Thu, Jul 21, 2011 at 10:44 PM, Jorge Marques leote.w...@gmail.comwrote:

 Hi guys, i have this macro i use to copy a range from column D of a
 worksheet of a workbook to column G of another workbook and worksheet, but
 it keeps giving me the same error saying that it´s subscript out of range
 in the line in yellow.

 Public wb, wbmes As Workbook
 Sub filldatabase()
 Call AbrirFile
 Call left
 wbmes.Close
 End Sub
 Private Sub AbrirFile()
 Dim Filter, Caption As String
 Dim SelectedFile As Variant
 Set wb = ThisWorkbook

 Filter = Ficheiro XLS (*.xls),(*.xls)
 Caption = Escolha o ficheiro a importar...
 SelectedFile = Application.GetOpenFilename(Filter, , Caption)
 If SelectedFile = False Then Exit Sub
 Set wbmes = Workbooks.Open(SelectedFile, 1, 1)
 End Sub

 Private Sub left()
 Dim a As Double
 wbmes.Activate
 wbmes.Sheets(Total_Refrige).Select
 wbmes.Sheets(Total_Refrige).Range(Range(D2),
 Range(D2).End(xlDown)).Copy
 wb.Activate
 If wb.Sheets(Pivot).Range(G2).Value   Then
 wb.Sheets(Pivot).Range(G1).End(xlDown).Offset(1, 0).Select
 Else
 wb.Sheets(Pivot).Range(G2).Select
 End If
 a = ActiveCell.Row
 wb.Sheets(Total Refrige).Paste
 Application.CutCopyMode = False
 i = a
 While wb.Sheets(Pivot).Range(G  i).Value  
 i = i + 1

 Wend
 End Sub

 Do you have any idea how to solve this?1000 thanks

 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


-- 
--
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com


Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel


Re: $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving same error

2011-07-21 Thread Anish Shrivastava
is it possible to attach the sheet? You can remove the data from it or
replace the values..

On Thu, Jul 21, 2011 at 11:04 PM, Jorge Marques leote.w...@gmail.comwrote:

 Yes, the names are all ok, i double checked it, even try to change names,
 but doesn´t work :S

   2011/7/21 Anish Shrivastava anish@gmail.com

 Please check if the sheet name is Pivot.
 if not then rename it to Pivot.
   On Thu, Jul 21, 2011 at 10:44 PM, Jorge Marques 
 leote.w...@gmail.comwrote:

 Hi guys, i have this macro i use to copy a range from column D of a
 worksheet of a workbook to column G of another workbook and worksheet, but
 it keeps giving me the same error saying that it´s subscript out of range
 in the line in yellow.

 Public wb, wbmes As Workbook
 Sub filldatabase()
 Call AbrirFile
 Call left
 wbmes.Close
 End Sub
 Private Sub AbrirFile()
 Dim Filter, Caption As String
 Dim SelectedFile As Variant
 Set wb = ThisWorkbook

 Filter = Ficheiro XLS (*.xls),(*.xls)
 Caption = Escolha o ficheiro a importar...
 SelectedFile = Application.GetOpenFilename(Filter, , Caption)
 If SelectedFile = False Then Exit Sub
 Set wbmes = Workbooks.Open(SelectedFile, 1, 1)
 End Sub

 Private Sub left()
 Dim a As Double
 wbmes.Activate
 wbmes.Sheets(Total_Refrige).Select
 wbmes.Sheets(Total_Refrige).Range(Range(D2),
 Range(D2).End(xlDown)).Copy
 wb.Activate
 If wb.Sheets(Pivot).Range(G2).Value   Then
 wb.Sheets(Pivot).Range(G1).End(xlDown).Offset(1, 0).Select
 Else
 wb.Sheets(Pivot).Range(G2).Select
 End If
 a = ActiveCell.Row
 wb.Sheets(Total Refrige).Paste
 Application.CutCopyMode = False
 i = a
 While wb.Sheets(Pivot).Range(G  i).Value  
 i = i + 1

 Wend
 End Sub

 Do you have any idea how to solve this?1000 thanks

 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


-- 
--
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com


Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel


Re: $$Excel-Macros$$ Help Macro doesn´t work anymore, keeps giving same error

2011-07-21 Thread ashish koul
add this line before if condition see if it helps

wb.Sheets(Pivot).select

On Thu, Jul 21, 2011 at 11:56 PM, Anish Shrivastava anish@gmail.comwrote:

 is it possible to attach the sheet? You can remove the data from it or
 replace the values..


 On Thu, Jul 21, 2011 at 11:04 PM, Jorge Marques leote.w...@gmail.comwrote:

 Yes, the names are all ok, i double checked it, even try to change names,
 but doesn´t work :S

   2011/7/21 Anish Shrivastava anish@gmail.com

 Please check if the sheet name is Pivot.
 if not then rename it to Pivot.
   On Thu, Jul 21, 2011 at 10:44 PM, Jorge Marques 
 leote.w...@gmail.comwrote:

 Hi guys, i have this macro i use to copy a range from column D of a
 worksheet of a workbook to column G of another workbook and worksheet, but
 it keeps giving me the same error saying that it´s subscript out of range
 in the line in yellow.

 Public wb, wbmes As Workbook
 Sub filldatabase()
 Call AbrirFile
 Call left
 wbmes.Close
 End Sub
 Private Sub AbrirFile()
 Dim Filter, Caption As String
 Dim SelectedFile As Variant
 Set wb = ThisWorkbook

 Filter = Ficheiro XLS (*.xls),(*.xls)
 Caption = Escolha o ficheiro a importar...
 SelectedFile = Application.GetOpenFilename(Filter, , Caption)
 If SelectedFile = False Then Exit Sub
 Set wbmes = Workbooks.Open(SelectedFile, 1, 1)
 End Sub

 Private Sub left()
 Dim a As Double
 wbmes.Activate
 wbmes.Sheets(Total_Refrige).Select
 wbmes.Sheets(Total_Refrige).Range(Range(D2),
 Range(D2).End(xlDown)).Copy
 wb.Activate
 If wb.Sheets(Pivot).Range(G2).Value   Then
 wb.Sheets(Pivot).Range(G1).End(xlDown).Offset(1, 0).Select
 Else
 wb.Sheets(Pivot).Range(G2).Select
 End If
 a = ActiveCell.Row
 wb.Sheets(Total Refrige).Paste
 Application.CutCopyMode = False
 i = a
 While wb.Sheets(Pivot).Range(G  i).Value  
 i = i + 1

 Wend
 End Sub

 Do you have any idea how to solve this?1000 thanks

 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


 --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel


  --

 --
 Some important links for excel users:
 1. Follow us on TWITTER for tips tricks and links :
 http://twitter.com/exceldailytip
 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
 3. Excel tutorials at http://www.excel-macros.blogspot.com
 4. Learn VBA Macros at http://www.quickvba.blogspot.com
 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com

 To post to this group, send email to excel-macros@googlegroups.com

 
 Like our page on facebook , Just follow below link
 http://www.facebook.com/discussexcel




-- 
*Regards*
* *
*Ashish Koul*
*akoul*.*blogspot*.com http://akoul.blogspot.com/
http://akoul.posterous.com/
*akoul*.wordpress.com http://akoul.wordpress.com/
My Linkedin Profile http://in.linkedin.com/pub/ashish-koul/10/400/830


P Before printing, think about the environment.

-- 
--
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel