Find Next row
Hello from Steved
I have a worksheet that gets new information Daily The below works fine except when I bring in new Data and run the macro it finds the next row which has a Surname in Col I and first name in Col J for example it may be row 100 the macro will Combine Col I and Col J into Col I which is What it is required to do, then it deletes everything above it please what is reqired to stop the deleting Thankyou. Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column B value Range("I" & i).Offset(0, 1).Value = "" Next End Sub |
Find Next row
Sub Trythis()
Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column B value 'Range("I" & i).Offset(0, 1).Value = "" Next End Sub "Steved" wrote: Hello from Steved I have a worksheet that gets new information Daily The below works fine except when I bring in new Data and run the macro it finds the next row which has a Surname in Col I and first name in Col J for example it may be row 100 the macro will Combine Col I and Col J into Col I which is What it is required to do, then it deletes everything above it please what is reqired to stop the deleting Thankyou. Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column B value Range("I" & i).Offset(0, 1).Value = "" Next End Sub |
Find Next row
Hello from Steved
Mike using Your Macro please how can I tell it to remove the Data in Column J as it is no longer required Thankyou Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column J value 'Range("I" & i).Offset(0, 1).Value = "" Next End Sub "Mike" wrote: Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column B value 'Range("I" & i).Offset(0, 1).Value = "" Next End Sub "Steved" wrote: Hello from Steved I have a worksheet that gets new information Daily The below works fine except when I bring in new Data and run the macro it finds the next row which has a Surname in Col I and first name in Col J for example it may be row 100 the macro will Combine Col I and Col J into Col I which is What it is required to do, then it deletes everything above it please what is reqired to stop the deleting Thankyou. Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column B value Range("I" & i).Offset(0, 1).Value = "" Next End Sub |
Find Next row
Hello from Steved
Please ignore Thankyou. "Steved" wrote: Hello from Steved Mike using Your Macro please how can I tell it to remove the Data in Column J as it is no longer required Thankyou Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column J value 'Range("I" & i).Offset(0, 1).Value = "" Next End Sub "Mike" wrote: Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column B value 'Range("I" & i).Offset(0, 1).Value = "" Next End Sub "Steved" wrote: Hello from Steved I have a worksheet that gets new information Daily The below works fine except when I bring in new Data and run the macro it finds the next row which has a Surname in Col I and first name in Col J for example it may be row 100 the macro will Combine Col I and Col J into Col I which is What it is required to do, then it deletes everything above it please what is reqired to stop the deleting Thankyou. Sub Trythis() Dim lastcell As Long Dim i As Long lastcell = Cells(Rows.Count, "I").End(xlUp).Row For i = 1 To lastcell 'combine Column I and J Range("I" & i).Value = Range("I" & i).Value & " " & _ Range("I" & i).Offset(0, 1).Value 'clear column B value Range("I" & i).Offset(0, 1).Value = "" Next End Sub |
All times are GMT +1. The time now is 09:12 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com