Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Hi all, I have some code below that another user kindly provided but would ask if anybody could help me with a slight modification - the code will copy and paste special a range from one worksheet to another worksheet and works great - but I have had some items that start with zero's in the origin and after the paste special ( because I only want values and not formula's to copy ) will convert say '012345 to 12345 but I do need the '012345 to be displayed as it is - any suggestions will be kindly received. Dim sourceRange As Range Dim destrange As Range Dim Lr As Long Lr = LastRow(Sheets("Worksheet1")) + 1 Set sourceRange = Sheets("Worksheet2").Range("BO7:CZ21") With sourceRange Set destrange = Sheets("Worksheet1").Range("A" & Lr). _ Resize(.Rows.Count, .Columns.Count) End With destrange.Value = sourceRange.Value End Sub Function LastRow(sh As Worksheet) On Error Resume Next LastRow = sh.Cells.Find(What:="*", _ After:=sh.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByRows, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Row On Error GoTo 0 End Function Function Lastcol(sh As Worksheet) On Error Resume Next Lastcol = sh.Cells.Find(What:="*", _ After:=sh.Range("A1"), _ Lookat:=xlPart, _ LookIn:=xlFormulas, _ SearchOrder:=xlByColumns, _ SearchDirection:=xlPrevious, _ MatchCase:=False).Column On Error GoTo 0 End Function -- sparx ------------------------------------------------------------------------ sparx's Profile: http://www.excelforum.com/member.php...o&userid=16787 View this thread: http://www.excelforum.com/showthread...hreadid=551639 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Paste Special and Linking | Excel Discussion (Misc queries) | |||
Paste Special Problem | Excel Discussion (Misc queries) | |||
strange Paste special | Excel Discussion (Misc queries) | |||
paste special - formulas | Excel Worksheet Functions | |||
Paste special treats cells as a picture | Excel Discussion (Misc queries) |