How to Lock Cell?

  • Thread starter Thread starter ginja
  • Start date Start date
G

ginja

Is there anyway you can lock the cursor on your sheet, so that when
macro is performed, the action is performed where you want it to occur
I have set up a macro so that i can store certain invoice details, an
so i recorded a macro that copies the cells and pastes them int
another sheet, but when the selected cell is elsewhere it seems t
alter the details.

any ideas
 
Hi
you may post your code. Probably some relative/absolute reference
issues in this recorded macro. Please explain also what you're tring to
achieve with an example
 
Here's the code: (hi again btw Frank)
Basically i want selected data from my invoice onto another sheet name
'InvoiceRecords'. The macro works, but if the cursor isnt on cell 'b18
it will start pasting the data where i do not want it to, should
create cell references to the pastes and if so, what do i put?

Sub SaveInvoice()
'
' SaveInvoice Macro
'

'
Range("B18").Select
Sheets("Invoice").Select
Range("C24").Select
Selection.Copy
Sheets("InvoiceRecords ").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Sheets("Invoice").Select
Range("C26").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("InvoiceRecords ").Select
Range("C18").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Sheets("Invoice").Select
Range("C28").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("InvoiceRecords ").Select
Range("D18").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Sheets("Invoice").Select
Range("C29").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("InvoiceRecords ").Select
Range("E18").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Range("F18").Select
Sheets("Invoice").Select
Range("F38").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("InvoiceRecords ").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Sheets("Invoice").Select
Range("C38").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("InvoiceRecords ").Select
Range("G18").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone
SkipBlanks:= _
False, Transpose:=False
Range("B18").Select
Application.CutCopyMode = False
Selection.EntireRow.Insert
Range("B18").Select
End Su
 
Hi
you'll always copy the defined cells in your macro (that is for example
C24).
Can you explain what you're trying to achieve. So what should happen if
you invoke this macro :-)
 
i'm trying to get it so information from the invoice (ie. customer name
product etc) appears and is stored in a table as history. By doin
that, i have made it so that on the click of a button the data i
copied and pasted into this new table and stored there. Each time th
invoice is saved, the data will be added to this table. I hope yo
understand, cant go into much more detail than that
 
Back
Top