ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How to modify a copy macro (https://www.excelbanter.com/excel-worksheet-functions/76266-how-modify-copy-macro.html)

EAHRENS

How to modify a copy macro
 
I am running the following macro to add an additional sheet.

Sheets("ICS 214").Select
Sheets("ICS 214").Copy Befo=Sheets(2)
'
End Sub

The problem I have is it copies over some information from unlocked cells
that I would like to have blank on the new sheet. What can i add to the macro
to have it copy the original sheet and automatically clear a group of cells
such as d29-d46?

Ardus Petus

How to modify a copy macro
 
With Sheets(("ICS 214")
.range("D29:D46").clearcontents
.copy befo= Sheets(2)
end with

HTH
--
AP

"EAHRENS" a écrit dans le message de
...
I am running the following macro to add an additional sheet.

Sheets("ICS 214").Select
Sheets("ICS 214").Copy Befo=Sheets(2)
'
End Sub

The problem I have is it copies over some information from unlocked cells
that I would like to have blank on the new sheet. What can i add to the

macro
to have it copy the original sheet and automatically clear a group of

cells
such as d29-d46?




EAHRENS

How to modify a copy macro
 
I apparently am not smart enough to apply your fix and need a lower level of
help. I changed the macro and it now reads:

Sub ICS214()
'
' ICS214 Macro
' Macro recorded 10/5/2005 by Eric Ahrens
'
With Sheets("ICS 214")
..Range("D29:D46").ClearContents
.Copy befo=Sheets(2)
End With
HTH
--

'
End Sub

When I run it, I get an errof message sub not defined and HTH is
highlighted. What did I do wrong?

"Ardus Petus" wrote:

With Sheets(("ICS 214")
.range("D29:D46").clearcontents
.copy befo= Sheets(2)
end with

HTH
--
AP

"EAHRENS" a écrit dans le message de
...
I am running the following macro to add an additional sheet.

Sheets("ICS 214").Select
Sheets("ICS 214").Copy Befo=Sheets(2)
'
End Sub

The problem I have is it copies over some information from unlocked cells
that I would like to have blank on the new sheet. What can i add to the

macro
to have it copy the original sheet and automatically clear a group of

cells
such as d29-d46?





Ardus Petus

How to modify a copy macro
 
Clear the HTH line!

HTH means Hope This Helps

HTH
--
AP

"EAHRENS" a écrit dans le message de
...
I apparently am not smart enough to apply your fix and need a lower level

of
help. I changed the macro and it now reads:

Sub ICS214()
'
' ICS214 Macro
' Macro recorded 10/5/2005 by Eric Ahrens
'
With Sheets("ICS 214")
.Range("D29:D46").ClearContents
.Copy befo=Sheets(2)
End With
HTH
--

'
End Sub

When I run it, I get an errof message sub not defined and HTH is
highlighted. What did I do wrong?

"Ardus Petus" wrote:

With Sheets(("ICS 214")
.range("D29:D46").clearcontents
.copy befo= Sheets(2)
end with

HTH
--
AP

"EAHRENS" a écrit dans le message de
...
I am running the following macro to add an additional sheet.

Sheets("ICS 214").Select
Sheets("ICS 214").Copy Befo=Sheets(2)
'
End Sub

The problem I have is it copies over some information from unlocked

cells
that I would like to have blank on the new sheet. What can i add to

the
macro
to have it copy the original sheet and automatically clear a group of

cells
such as d29-d46?







EAHRENS

How to modify a copy macro
 
I figured I was doing something wrong. i removed it and now get an error
message that reads: Run-time error 1004, Cannot change part of a merged cell.
Debug highlights .Range("D29:D46").ClearContents

The macro I am running reads:

Sub ICS214()
'
' ICS214 Macro
' Macro recorded 10/5/2005 by Eric Ahrens
'
With Sheets("ICS 214")
..Range("D29:D46").ClearContents
.Copy befo=Sheets(2)
End With

'
End Sub

When I runit I get an error message that

"Ardus Petus" wrote:

Clear the HTH line!

HTH means Hope This Helps

HTH
--
AP

"EAHRENS" a écrit dans le message de
...
I apparently am not smart enough to apply your fix and need a lower level

of
help. I changed the macro and it now reads:

Sub ICS214()
'
' ICS214 Macro
' Macro recorded 10/5/2005 by Eric Ahrens
'
With Sheets("ICS 214")
.Range("D29:D46").ClearContents
.Copy befo=Sheets(2)
End With
HTH
--

'
End Sub

When I run it, I get an errof message sub not defined and HTH is
highlighted. What did I do wrong?

"Ardus Petus" wrote:

With Sheets(("ICS 214")
.range("D29:D46").clearcontents
.copy befo= Sheets(2)
end with

HTH
--
AP

"EAHRENS" a écrit dans le message de
...
I am running the following macro to add an additional sheet.

Sheets("ICS 214").Select
Sheets("ICS 214").Copy Befo=Sheets(2)
'
End Sub

The problem I have is it copies over some information from unlocked

cells
that I would like to have blank on the new sheet. What can i add to

the
macro
to have it copy the original sheet and automatically clear a group of
cells
such as d29-d46?








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com