Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I have a summary sheet that up until this morning worked just great. It deleted the current sheet, added another, and transferred all the data. Somebody other than me will be using it now though, and I'd like to make it a little more user friendly. I have the coding except for the part where it loops through and picks the data up. Below is the first part of the coding from when it deleted the worksheet. How can I modify that to just grab the data and put it on there? I appreciate any help. Dim sh As Worksheet Dim DestSh As Worksheet Dim Last As Long Dim CopyRng As Range Application.ScreenUpdating = False Application.EnableEvents = False 'Delete the sheet "Exceptions" if it exists Application.DisplayAlerts = False On Error Resume Next ActiveWorkbook.Worksheets("Exceptions").Delete On Error GoTo 0 Application.DisplayAlerts = True 'Add a worksheet with the name "Exceptions" Set DestSh = ActiveWorkbook.Worksheets.Add DestSh.Name = "Exceptions" 'loop through all worksheets and copy the data to the DestSh For Each sh In ActiveWorkbook.Worksheets If sh.Name < DestSh.Name Then 'Find the last row with data on the DestSh Last = LastRow(DestSh) 'Fill in the range that you want to copy Set CopyRng = sh.Range("L11:V93") 'Test if there enough rows in the DestSh to copy all the data If Last + CopyRng.Rows.Count DestSh.Rows.Count Then MsgBox "There are not enough rows in the Destsh" GoTo ExitTheSub End If 'This copies all values/formats With CopyRng DestSh.Cells(Last + 1, "A").Resize(.Rows.Count, _ .Columns.Count).Value = .Value End With End If Next ExitTheSub: Application.GoTo DestSh.Cells(1) 'AutoFit the column width in the DestSh sheet DestSh.Columns.AutoFit Application.EnableEvents = True -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Joe
I am not sure what you want Do you want to copy the data on the Exceptions sheet below the data that is already on that sheet ? -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Joe_Hunt via OfficeKB.com" <u45578@uwe wrote in message news:96d0ee6cb37f5@uwe... Hello, I have a summary sheet that up until this morning worked just great. It deleted the current sheet, added another, and transferred all the data. Somebody other than me will be using it now though, and I'd like to make it a little more user friendly. I have the coding except for the part where it loops through and picks the data up. Below is the first part of the coding from when it deleted the worksheet. How can I modify that to just grab the data and put it on there? I appreciate any help. Dim sh As Worksheet Dim DestSh As Worksheet Dim Last As Long Dim CopyRng As Range Application.ScreenUpdating = False Application.EnableEvents = False 'Delete the sheet "Exceptions" if it exists Application.DisplayAlerts = False On Error Resume Next ActiveWorkbook.Worksheets("Exceptions").Delete On Error GoTo 0 Application.DisplayAlerts = True 'Add a worksheet with the name "Exceptions" Set DestSh = ActiveWorkbook.Worksheets.Add DestSh.Name = "Exceptions" 'loop through all worksheets and copy the data to the DestSh For Each sh In ActiveWorkbook.Worksheets If sh.Name < DestSh.Name Then 'Find the last row with data on the DestSh Last = LastRow(DestSh) 'Fill in the range that you want to copy Set CopyRng = sh.Range("L11:V93") 'Test if there enough rows in the DestSh to copy all the data If Last + CopyRng.Rows.Count DestSh.Rows.Count Then MsgBox "There are not enough rows in the Destsh" GoTo ExitTheSub End If 'This copies all values/formats With CopyRng DestSh.Cells(Last + 1, "A").Resize(.Rows.Count, _ .Columns.Count).Value = .Value End With End If Next ExitTheSub: Application.GoTo DestSh.Cells(1) 'AutoFit the column width in the DestSh sheet DestSh.Columns.AutoFit Application.EnableEvents = True -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, I'm sometimes not very good at explaining. things. I'd like to copy
the data from cells L11:V93 from every other worksheet in the workbook into the Exceptions sheet. I can manipulate it from there. I appreciate your help. Ron de Bruin wrote: Hi Joe I am not sure what you want Do you want to copy the data on the Exceptions sheet below the data that is already on that sheet ? Hello, I have a summary sheet that up until this morning worked just great. It [quoted text clipped - 58 lines] Application.EnableEvents = True -- Message posted via http://www.officekb.com |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is this not working for you then ?
http://www.rondebruin.nl/copy2.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Joe_Hunt via OfficeKB.com" <u45578@uwe wrote in message news:96d127c2134f8@uwe... Sorry, I'm sometimes not very good at explaining. things. I'd like to copy the data from cells L11:V93 from every other worksheet in the workbook into the Exceptions sheet. I can manipulate it from there. I appreciate your help. Ron de Bruin wrote: Hi Joe I am not sure what you want Do you want to copy the data on the Exceptions sheet below the data that is already on that sheet ? Hello, I have a summary sheet that up until this morning worked just great. It [quoted text clipped - 58 lines] Application.EnableEvents = True -- Message posted via http://www.officekb.com |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Looks a lot like what I have. I took some coding from another workbook and
modified it, so maybe your site is where it originated (I think I have a book at home with an author by your name. Is that you?). After this though the worksheet is manipulated to gather the information into a coherent form, and some calculations are done with it. I'd like this process to be kicked off by changing a percentage in a specified cell (all that begins in the next set of instructions), and to make that work I need to gather this information without deleting the sheet, I guess, by having a change event in the coding of the worksheet. My thought was just to clear the information existing in the worksheet and then gathering what I needed from the other worksheets. I was trying not to make my original post too long. Ron de Bruin wrote: Is this not working for you then ? http://www.rondebruin.nl/copy2.htm Sorry, I'm sometimes not very good at explaining. things. I'd like to copy the data from cells L11:V93 from every other worksheet in the workbook into [quoted text clipped - 10 lines] Application.EnableEvents = True -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
No Book from me but maybe you seen my article on MSDN
I will reply tomorrow with a example that clear the cells on the Exceptions sheet instead of deleting the sheet. Bed time for me now -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Joe_Hunt via OfficeKB.com" <u45578@uwe wrote in message news:96d174c613b65@uwe... Looks a lot like what I have. I took some coding from another workbook and modified it, so maybe your site is where it originated (I think I have a book at home with an author by your name. Is that you?). After this though the worksheet is manipulated to gather the information into a coherent form, and some calculations are done with it. I'd like this process to be kicked off by changing a percentage in a specified cell (all that begins in the next set of instructions), and to make that work I need to gather this information without deleting the sheet, I guess, by having a change event in the coding of the worksheet. My thought was just to clear the information existing in the worksheet and then gathering what I needed from the other worksheets. I was trying not to make my original post too long. Ron de Bruin wrote: Is this not working for you then ? http://www.rondebruin.nl/copy2.htm Sorry, I'm sometimes not very good at explaining. things. I'd like to copy the data from cells L11:V93 from every other worksheet in the workbook into [quoted text clipped - 10 lines] Application.EnableEvents = True -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200905/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conditional copy from multiple sheets to one sheet | Excel Programming | |||
Conditionally copy from multiple sheets to one sheet | Excel Programming | |||
Copy data from multiple sheets into new sheet | Excel Worksheet Functions | |||
How do I copy setting from one sheet to multiple sheets in Excel? | Excel Discussion (Misc queries) | |||
copy data in one sheet to multiple sheets in same workbook | Excel Worksheet Functions |