Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() and why does this script make it happen please Sub MergeMove() ' ' MergeMove Macro ' With ActiveSheet xlastrow = .Cells(Rows.Count, 2).End(xlUp).Row For x = 1 To xlastrow .Cells(x, 15) = .Cells(x, 8) & " " & .Cells(x, 9) & " " Next x End With ' Columns("O:O").Select Selection.Copy Columns("H:H").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone SkipBlanks:= _ False, Transpose:=False Columns("I:I").Select Application.CutCopyMode = False Selection.Delete Shift:=xlToLeft Columns("N:N").Select Selection.Delete Shift:=xlToLeft Range("H1").Select ActiveCell.FormulaR1C1 = "Address Ln.1" Range("H2").Select ' Columns("G:G").Select Selection.NumberFormat = "yyyy-mm-dd" Columns("D:D").Select Selection.Replace What:="", Replacement:="N/A", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Columns("H:H").Select Selection.Replace What:="", Replacement:="N/A", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Columns("I:I").Select Selection.Replace What:="", Replacement:="N/A", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="ns_no", Replacement:="NS No.", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="surname", Replacement:="Surname", LookAt: _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="forename1", Replacement:="Forename 1" LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="forename2", Replacement:="Forename 2" LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="title", Replacement:="Title", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="sex", Replacement:="Sex", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="dob", Replacement:="DOB", LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="house_no", Replacement:="Address Ln.1" LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="road_name", Replacement:="Address Ln.2" LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="town_name", Replacement:="Town", LookAt: _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Rows("1:1").Select Selection.Replace What:="postcode", Replacement:="Post Code" LookAt:= _ xlPart, SearchOrder:=xlByRows, MatchCase:=False Columns("M:M").Select With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop Operator:= _ xlBetween, Formula1:="N/A,P,L,D" .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "P=Newly found" & Chr(10) & "L=Left" & Chr(10 & "D=Died" .ErrorMessage = "" .ShowInput = True .ShowError = True End With Range("L1").Select ActiveCell.FormulaR1C1 = "PCode" Range("M1").Select ActiveCell.FormulaR1C1 = "Registration Details" Cells.Select Selection.Columns.AutoFit With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = False End With With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = False End With With Selection.Font .Name = "Arial" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With Selection.Font .Name = "Arial" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Rows("1:1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = False .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = False End With ActiveWindow.SmallScroll ToRight:=3 Range("M1").Select Columns("M:M").ColumnWidth = 9.86 Columns("M:M").ColumnWidth = 10.86 With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .ShrinkToFit = False .MergeCells = False End With Columns("L:L").Select Selection.Replace What:="", Replacement:="N8???", LookAt:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False Range("A1").Select Columns("O:O").Select Selection.Copy Columns("H:H").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False Columns("I:I").Select Application.CutCopyMode = False Selection.Delete Shift:=xlToLeft Columns("N:N").Select Selection.Delete Shift:=xlToLeft Range("H1").Select ActiveCell.FormulaR1C1 = "Address Ln.1" Range("H2").Select End Sub -- Steve M ------------------------------------------------------------------------ Steve M's Profile: http://www.excelforum.com/member.php...o&userid=32520 View this thread: http://www.excelforum.com/showthread...hreadid=524276 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Whats the best way to... | Excel Worksheet Functions | |||
Whats the best way to... | Excel Worksheet Functions | |||
Whats the best way to... | Excel Worksheet Functions | |||
Messgae Box on Exit Application | Excel Programming | |||
"Can't Show Modally" - Run-Time Error '400' Problem | Excel Programming |