ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro showing Offset instead of Ranges (https://www.excelbanter.com/excel-programming/331051-macro-showing-offset-instead-ranges.html)

Diane Thorpe

Macro showing Offset instead of Ranges
 
Dear All
I have created exactly the same simple macro on several PCs, but it shows
differently on just one of them and I don't know why. I have a feeling there
must be a setting somewhere either within Excel, VB or even on the individual
PC that's affecting things. I can't seem to find out why and wonder if
anyone has a simple solution please?

The macros should read something like:
Range("H5:H15").Select
Selection.Copy
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C5:F15").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("E1").Select
Selection.ClearContents

but instead it looks like:
ActiveCell.Offset(-14, -1).Range("A1:A11").Select
Selection.Copy
o ActiveCell.Offset(0, -6).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1:D11").Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveCell.Offset(-3, -2).Range("A1").Select
Selection.ClearContents

The incorrect macro doesn't even run and I have no idea why Offset and
values are appearing instead of cell references.

Many thanks in anticipation,
Diane Thorpe

K Dales[_2_]

Macro showing Offset instead of Ranges
 
The "oddball" macro is using relative referencing (the offsets) rather than
absolute. There is a button on the Macro Recording toolbar that switches
between the two types of referencing, so it must have been pressed on that
last one.

As for why it does not run - if there are no error messages, check Tools...
Macro... Security and see if it is set to High on that machine. If it is,
set it to medium or low and close/restart Excel.

"Diane Thorpe" wrote:

Dear All
I have created exactly the same simple macro on several PCs, but it shows
differently on just one of them and I don't know why. I have a feeling there
must be a setting somewhere either within Excel, VB or even on the individual
PC that's affecting things. I can't seem to find out why and wonder if
anyone has a simple solution please?

The macros should read something like:
Range("H5:H15").Select
Selection.Copy
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C5:F15").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("E1").Select
Selection.ClearContents

but instead it looks like:
ActiveCell.Offset(-14, -1).Range("A1:A11").Select
Selection.Copy
o ActiveCell.Offset(0, -6).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1:D11").Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveCell.Offset(-3, -2).Range("A1").Select
Selection.ClearContents

The incorrect macro doesn't even run and I have no idea why Offset and
values are appearing instead of cell references.

Many thanks in anticipation,
Diane Thorpe


Diane Thorpe

Macro showing Offset instead of Ranges
 
Fantastic!! Thank you SO much. I've tried it again and it works a treat.
It appears that once you've pressed the relative button, it stays on even
when you record a further macro, hence it did the same thing when we tried a
different macro.

So easy when you know the answer :-)
Thanks again,
Diane

"K Dales" wrote:

The "oddball" macro is using relative referencing (the offsets) rather than
absolute. There is a button on the Macro Recording toolbar that switches
between the two types of referencing, so it must have been pressed on that
last one.

As for why it does not run - if there are no error messages, check Tools...
Macro... Security and see if it is set to High on that machine. If it is,
set it to medium or low and close/restart Excel.

"Diane Thorpe" wrote:

Dear All
I have created exactly the same simple macro on several PCs, but it shows
differently on just one of them and I don't know why. I have a feeling there
must be a setting somewhere either within Excel, VB or even on the individual
PC that's affecting things. I can't seem to find out why and wonder if
anyone has a simple solution please?

The macros should read something like:
Range("H5:H15").Select
Selection.Copy
Range("B5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C5:F15").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("E1").Select
Selection.ClearContents

but instead it looks like:
ActiveCell.Offset(-14, -1).Range("A1:A11").Select
Selection.Copy
o ActiveCell.Offset(0, -6).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Range("A1:D11").Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveCell.Offset(-3, -2).Range("A1").Select
Selection.ClearContents

The incorrect macro doesn't even run and I have no idea why Offset and
values are appearing instead of cell references.

Many thanks in anticipation,
Diane Thorpe



All times are GMT +1. The time now is 06:23 AM.

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