Selecting down issue

ogloc95

New Member
Joined
Dec 19, 2016
Messages
1
Hi guys,

I'm just building a macro at the moment for the first time so I'm not very experienced in them as of yet.

Essentially, I'm creating a macro that will create a separate graph each time the data in a certain column changes. To mark where the changes are to help me create the macro, I used a formula of =IF(A1=A2,"","X"). Only problem is, when I (Ctrl + Shift + Down), it skips past all the X's and goes to the end of the data set. I want to be able to (Ctrl + Shift + Down) and stop at the X each time.

My current macro script is:

Sub Macro1()
'
' Macro1 Macro
'


'
Range("D1").Select
ActiveCell.FormulaR1C1 = "=IF(RC[-3]=R[1]C[-3],"""",""X"")"
Range("D1").Select
Selection.AutoFill Destination:=Range("D1:D23")
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveSheet.Paste
Application.CutCopyMode = False
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,648
Office Version
  1. 365
  2. 2019
  3. 2013
  4. 2007
Platform
  1. Windows
Try using

Code:
Sub MM1()
With Range("D1:D23")
    .Formula = "=IF(A1=A2,"""",""X"")"
    .Value = .Value
End With
End Sub

then using CTRL + Down Arrow to stop at each X
 
Upvote 0

Forum statistics

Threads
1,195,636
Messages
6,010,845
Members
441,569
Latest member
PeggyLee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top