Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Update multiple sheets at once

Hi,

I have a master work book with data in multiple sheets.
I have another sheet in same master workbook with values that I want
to remove from each sheet of master work book to update it. Entire row
of each sheet should delete in order to get updated.

*Values means figure like 8977109987276633316 and more in length.

Example:
Master workbook
Sheet1: 10 values
Sheet2: 20 values
Sheet3: 20 values
Sheet(n):

Datasheet (also in masterwork book containing values to be removed)
column1 with values for sheet1 to be removed: 4
column2 with values for sheet2 to be removed: 7
column3 with values for sheet3 to be removed: 9
column(n)

End result:
Sheet1: 6 values
Sheet2: 13 values
Sheet3: 11 values

If values not found, then there should be an error message like
"continue with next sheet or not".

Would be a great help.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default Update multiple sheets at once

If your sheets have headers in the first row you could do it using ADO
and selecting from both sheets.

If your data isn't stored that way then you have a lot of line-by-line
VBA programming to do. Good luck.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Update multiple sheets at once

try this code. I had problems with the find method when selecting an entire
worksheet. It didn't find the data in the first cell. Had to add a fix for
an error in VBA. I find the more I try to use the Find method the more
problems I have with this method.

Sub removerows()

Const N = 3 'Number of sheets

With Sheets("Datasheet")
For SheetCount = 1 To N
SheetName = "Sheet" & SheetCount
Sheets(SheetName).Activate
Cells.Select
Lastrow = .Cells(Rows.Count, SheetCount). _
End(xlUp).Row
For RowCount = 1 To Lastrow
findNumber = _
.Cells(RowCount, SheetCount).Value
found = False
'patch becaue find doesn't find number
' in cell "A1" when using selection method
Do While Cells(1, 1).Value = findNumber
Cells(1, 1).EntireRow.Delete
found = True
Loop
Do While (True)
Set c = Selection. _
Find(what:=findNumber, LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
found = True
Else
Exit Do
End If
Loop
If found = False Then
MsgBox ("Did not find number " & findNumber)
End If
Next RowCount
Next SheetCount
End With
End Sub


"Sinner" wrote:

Hi,

I have a master work book with data in multiple sheets.
I have another sheet in same master workbook with values that I want
to remove from each sheet of master work book to update it. Entire row
of each sheet should delete in order to get updated.

*Values means figure like 8977109987276633316 and more in length.

Example:
Master workbook
Sheet1: 10 values
Sheet2: 20 values
Sheet3: 20 values
Sheet(n):

Datasheet (also in masterwork book containing values to be removed)
column1 with values for sheet1 to be removed: 4
column2 with values for sheet2 to be removed: 7
column3 with values for sheet3 to be removed: 9
column(n)

End result:
Sheet1: 6 values
Sheet2: 13 values
Sheet3: 11 values

If values not found, then there should be an error message like
"continue with next sheet or not".

Would be a great help.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Update multiple sheets at once

On Sep 2, 9:00 am, "
wrote:
If your sheets have headers in the first row you could do it using ADO
and selecting from both sheets.

If your data isn't stored that way then you have a lot of line-by-line
VBA programming to do. Good luck.



Yes I can have headers in the first row.
Can u help?

Thx


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Update multiple sheets at once

I will let u know, thank you very much Joel.
Really appreciate.


On Sep 2, 10:52 am, Joel wrote:
try this code. I had problems with the find method when selecting an entire
worksheet. It didn't find the data in the first cell. Had to add a fix for
an error in VBA. I find the more I try to use the Find method the more
problems I have with this method.

Sub removerows()

Const N = 3 'Number of sheets

With Sheets("Datasheet")
For SheetCount = 1 To N
SheetName = "Sheet" & SheetCount
Sheets(SheetName).Activate
Cells.Select
Lastrow = .Cells(Rows.Count, SheetCount). _
End(xlUp).Row
For RowCount = 1 To Lastrow
findNumber = _
.Cells(RowCount, SheetCount).Value
found = False
'patch becaue find doesn't find number
' in cell "A1" when using selection method
Do While Cells(1, 1).Value = findNumber
Cells(1, 1).EntireRow.Delete
found = True
Loop
Do While (True)
Set c = Selection. _
Find(what:=findNumber, LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
found = True
Else
Exit Do
End If
Loop
If found = False Then
MsgBox ("Did not find number " & findNumber)
End If
Next RowCount
Next SheetCount
End With
End Sub



"Sinner" wrote:
Hi,


I have a master work book with data in multiple sheets.
I have another sheet in same master workbook with values that I want
to remove from each sheet of master work book to update it. Entire row
of each sheet should delete in order to get updated.


*Values means figure like 8977109987276633316 and more in length.


Example:
Master workbook
Sheet1: 10 values
Sheet2: 20 values
Sheet3: 20 values
Sheet(n):


Datasheet (also in masterwork book containing values to be removed)
column1 with values for sheet1 to be removed: 4
column2 with values for sheet2 to be removed: 7
column3 with values for sheet3 to be removed: 9
column(n)


End result:
Sheet1: 6 values
Sheet2: 13 values
Sheet3: 11 values


If values not found, then there should be an error message like
"continue with next sheet or not".


Would be a great help.- Hide quoted text -


- Show quoted text -



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
Want to update hyperlinks through multiple sheets but can't Billznik Excel Worksheet Functions 1 February 28th 12 06:19 AM
How to update data from multiple sheets to one specific sheets Khawajaanwar Excel Discussion (Misc queries) 4 January 15th 10 07:31 AM
Update same charts in multiple sheets at once Div[_2_] Excel Worksheet Functions 1 January 28th 09 08:10 PM
Update multiple sheets Dave Excel Worksheet Functions 1 March 7th 08 04:03 AM
Update multiple sheets at once Sinner Excel Discussion (Misc queries) 1 September 2nd 07 07:54 AM


All times are GMT +1. The time now is 03:56 PM.

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

About Us

"It's about Microsoft Excel"