ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Having trouble with simple macro! (https://www.excelbanter.com/excel-programming/293181-having-trouble-simple-macro.html)

Simon Lloyd[_397_]

Having trouble with simple macro!
 
I have recorded a macro to copy from one cell on a sheet to anothe
sheet i have used the Ctrl+End then down to tell it where to start bu
upon next operation it fills the same cell...also i want any previou
input by the macro to be unchangeable without a password.......Ca
anyone help? heres the code!
Sub Entry()
'
' Entry Macro
' Macro recorded 01/03/2004 by Simon
'
' Keyboard Shortcut: Ctrl+r
'
Range("J17").Select
Selection.Copy
Sheets("2nd Skill last used").Select
Range("A1").Select
Selection.End(xlDown).Select
ActiveSheet.Paste
Sheets("User Sheet").Select
Range("C19").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("2nd Skill last used").Select
Range("D46").Select
ActiveSheet.Paste
Range("F46").Select
Sheets("User Sheet").Select
Range("N17").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("2nd Skill last used").Select
ActiveSheet.Paste
Range("G46").Select
Sheets("User Sheet").Select
Range("B28").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("2nd Skill last used").Select
ActiveSheet.Paste
Range("A47").Select
Sheets("User Sheet").Select
End Sub

Simo

--
Message posted from http://www.ExcelForum.com


brad

Having trouble with simple macro!
 
If you go into a worksheet and do End-Down on a column of
data, it stops at the last populated row. If you want the
next blank row, you need to offset the range that the End
property returns.

So:
Selection.End(xlDown).Offset(1, 0).Select

would be the next empty row in the column.

Take a look at the ToolsProtection menu to learn about
password protecting your worksheet/workbook. When you
write "previous input by the macro", do you mean that
those are the only locked cells? If so, you'll have to
set the Locked property on each range you paste.

Hope that helps.

-Brad

-----Original Message-----
I have recorded a macro to copy from one cell on a sheet

to another
sheet i have used the Ctrl+End then down to tell it where

to start but
upon next operation it fills the same cell...also i want

any previous
input by the macro to be unchangeable without a

password.......Can
anyone help? heres the code!
Sub Entry()
'
' Entry Macro
' Macro recorded 01/03/2004 by Simon
'
' Keyboard Shortcut: Ctrl+r
'
Range("J17").Select
Selection.Copy
Sheets("2nd Skill last used").Select
Range("A1").Select
Selection.End(xlDown).Select
ActiveSheet.Paste
Sheets("User Sheet").Select
Range("C19").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("2nd Skill last used").Select
Range("D46").Select
ActiveSheet.Paste
Range("F46").Select
Sheets("User Sheet").Select
Range("N17").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("2nd Skill last used").Select
ActiveSheet.Paste
Range("G46").Select
Sheets("User Sheet").Select
Range("B28").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("2nd Skill last used").Select
ActiveSheet.Paste
Range("A47").Select
Sheets("User Sheet").Select
End Sub

Simon


---
Message posted from http://www.ExcelForum.com/

.



All times are GMT +1. The time now is 05:12 AM.

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