Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 121
Default Reference 2 separate workbooks!

Version: Excel 2000 & 2003
* using only one instance

I'm stuck and have no other ideas, I've search the newsgroup and
researched my macros and I can't find my problem with the following
macro.

Workbooks("Equip_List_FF.xls").Worksheets: has about 306 worksheets
visible and hidden. I need to get data from each worksheet and copy it
to Workbooks("FF_Zone5_Bldgs.xls").Worksheets("WATER TREATMENT -
(ALPH)").

But, when I run this macro it gives me the error "Object required" and
I can't figure out why. Could someone point me in the right direction
to fix this error, than you for your help.

Sub WorkSheetsBldgNumberNameCellB()
'Worksheets Building Name & Number in cell
'------
Dim wbkA As Workbook, wbkB As Workbook
Dim wksA As Worksheet, wksB As Worksheet
Application.ScreenUpdating = False
Set wbkA = Workbooks("Equip_List_FF.xls")
Set wbkB = Workbooks("FF_Zone5_Bldgs.xls")
Set wksB = wbkB.Worksheets("WATER TREATMENT - (ALPH)")
'------
For Each wksA In wbkA.Worksheets
If wksA.Visible = xlSheetVisible Then
'------
wksB.Worksheets("WATER TREATMENT -
(ALPH)").Range("B65535").End(xlUp).Offset(1, 0).Address = _
Right(wksA.Range("C2"), 4).Value '1 below last row of data skip
blanks
'------
wksB.Range("B65535").End(xlUp).Offset(, 1) =
Left(wksA.Range("C1").Value, _
Len(wksA.Range("C1").Value) - 16)
End If
Next
Application.ScreenUpdating = True
End Sub

Thank you for your help,
jfcby

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Reference 2 separate workbooks!

On Aug 22, 9:44 pm, jfcby wrote:
Version: Excel 2000 & 2003
* using only one instance

I'm stuck and have no other ideas, I've search the newsgroup and
researched my macros and I can't find my problem with the following
macro.

Workbooks("Equip_List_FF.xls").Worksheets: has about 306 worksheets
visible and hidden. I need to get data from each worksheet and copy it
to Workbooks("FF_Zone5_Bldgs.xls").Worksheets("WATER TREATMENT -
(ALPH)").

But, when I run this macro it gives me the error "Object required" and
I can't figure out why. Could someone point me in the right direction
to fix this error, than you for your help.

Sub WorkSheetsBldgNumberNameCellB()
'Worksheets Building Name & Number in cell
'------
Dim wbkA As Workbook, wbkB As Workbook
Dim wksA As Worksheet, wksB As Worksheet
Application.ScreenUpdating = False
Set wbkA = Workbooks("Equip_List_FF.xls")
Set wbkB = Workbooks("FF_Zone5_Bldgs.xls")
Set wksB = wbkB.Worksheets("WATER TREATMENT - (ALPH)")
'------
For Each wksA In wbkA.Worksheets
If wksA.Visible = xlSheetVisible Then
'------
wksB.Worksheets("WATER TREATMENT -
(ALPH)").Range("B65535").End(xlUp).Offset(1, 0).Address = _
Right(wksA.Range("C2"), 4).Value '1 below last row of data skip
blanks
'------
wksB.Range("B65535").End(xlUp).Offset(, 1) =
Left(wksA.Range("C1").Value, _
Len(wksA.Range("C1").Value) - 16)
End If
Next
Application.ScreenUpdating = True
End Sub

Thank you for your help,
jfcby


Looks like

wksB.Worksheets("WATER TREATMENT -
(ALPH)").Range("B65535").End(xlUp).Offset(1, 0).Address = _
Right(wksA.Range("C2"), 4).Value '1 below last row of data skip
blanks

Should be

wbkB.Worksheets("WATER TREATMENT -
(ALPH)").Range("B65535").End(xlUp).Offset(1, 0).Address = _
Right(wksA.Range("C2"), 4).Value '1 below last row of data skip
blanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Reference 2 separate workbooks!

Hello,

Thank you Don for your help!

What a challenge, but, this is the working VBA Macro Code:

'-- MACRO --
Sub WorkSheetsBldgNumberNameCellB()
'Copy data from workbook 1 visible worksheets to workbook 2 worksheet(1
worksheet only)
Dim wbkA As Workbook
Dim wbkB As Workbook
Dim wksA As Worksheet
Dim wksB As Worksheet
Application.ScreenUpdating = False
Set wbkA = Workbooks("Equip_List_FF.xls")
Set wbkB = Workbooks("FF_Zone5_Bldgs.xls")
Set wksB = wbkB.Worksheets("WATER TREATMENT - ALPH")
'wbkA(workbooks) wksA(worksheets)
For Each wksA In wbkA.Worksheets
'Visible worksheets only
If wksA.Visible = xlSheetVisible Then
'Copy data from wksA(worksheet) Range to wksB(worksheet) 1 below last
row of data skip blanks
wksB.Range("B65535").End(xlUp).Offset(1, 0) =
Right(wksA.Range("C2").Value, 4)
'Copy data from wksA(worksheet) Range to wks(worksheet) offset 1 to the
right of cell
wksB.Range("B65535").End(xlUp).Offset(0, 1) =
Left(wksA.Range("C1").Value, _
Len(wksA.Range("C1").Value) - 16)
End If
Next
Application.ScreenUpdating = True
End Sub
'<<-- MACRO --

Thank you for your help,


jfcby
"jfcby" wrote in message
ups.com...
Version: Excel 2000 & 2003
* using only one instance

I'm stuck and have no other ideas, I've search the newsgroup and
researched my macros and I can't find my problem with the following
macro.

Workbooks("Equip_List_FF.xls").Worksheets: has about 306 worksheets
visible and hidden. I need to get data from each worksheet and copy it
to Workbooks("FF_Zone5_Bldgs.xls").Worksheets("WATER TREATMENT -
(ALPH)").

But, when I run this macro it gives me the error "Object required" and
I can't figure out why. Could someone point me in the right direction
to fix this error, than you for your help.

Sub WorkSheetsBldgNumberNameCellB()
'Worksheets Building Name & Number in cell
'------
Dim wbkA As Workbook, wbkB As Workbook
Dim wksA As Worksheet, wksB As Worksheet
Application.ScreenUpdating = False
Set wbkA = Workbooks("Equip_List_FF.xls")
Set wbkB = Workbooks("FF_Zone5_Bldgs.xls")
Set wksB = wbkB.Worksheets("WATER TREATMENT - (ALPH)")
'------
For Each wksA In wbkA.Worksheets
If wksA.Visible = xlSheetVisible Then
'------
wksB.Worksheets("WATER TREATMENT -
(ALPH)").Range("B65535").End(xlUp).Offset(1, 0).Address = _
Right(wksA.Range("C2"), 4).Value '1 below last row of data skip
blanks
'------
wksB.Range("B65535").End(xlUp).Offset(, 1) =
Left(wksA.Range("C1").Value, _
Len(wksA.Range("C1").Value) - 16)
End If
Next
Application.ScreenUpdating = True
End Sub

Thank you for your help,
jfcby



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I join two separate workbooks? Mike[_22_] New Users to Excel 1 June 10th 09 07:58 PM
how do I get separate workbooks in separate windows John Collins Excel Discussion (Misc queries) 3 October 28th 06 12:07 AM
HOW DO I CALCULATE SEPARATE WORKBOOKS INTO ONE? Cindy Excel Worksheet Functions 1 March 2nd 06 03:29 PM
HOW DO I CALCULATE SEPARATE WORKBOOKS INTO ONE? Gary L Brown Excel Worksheet Functions 0 March 2nd 06 03:27 PM
WorkBooks In Separate Windows. Sam New Users to Excel 1 January 19th 05 12:08 AM


All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"