Trying2learnVBA
Board Regular
- Joined
- Aug 21, 2019
- Messages
- 67
- Office Version
- 365
- 2021
- Platform
- Windows
Hello,
I seem unable to find a way to first copy n paste say Column B:B to sheet2 say A:A (I do this fine lol)
Then I want to run a find and replace on Sheet1 col b:b without the find & replace doing the same thing to sheet2.
As I want to then copy sheet2 a:a to sheet1 a:a to create my cross reference.
This I what I have
The first part is deleting rows I do not need. Rows with 0.
Sub sbDelete_Rows_Based_On_Multiple_Criteria()
'''''''''''''''
'FICS MA ENTRY'
'''''''''''''''
Sheets("1").Select
Dim lRow As Long
Dim iCntr As Long
lRow = 20000
For iCntr = lRow To 1 Step -1
If Cells(iCntr, 6) = 0 And Trim(Cells(iCntr, 7)) = 0 Then
Rows(iCntr).Delete
End If
Next
Columns("C:D").Delete
Range("B:B").Copy Destination:=Sheets("2").Range("A:A")
With Worksheets("1").Range("b:b")
.Replace "8000052", "80000260000-1"
.Replace "800162", "80000620000-2"
.Replace "809018", "80900180000-3"
.Replace "111026", "11440500000-4"
.Replace "131029", "6100010000-5"
.Replace "703010", "70400020000-6"
.Replace "703011", "70300010000-7"
.Replace "703013", "70300020000-8"
End With
End Sub
I have a lot more of these references but If I can get this to work - I could do the rest.
I also tried .range("b:b").replace....... it works but it changes my info on sheet two which I want to preserve
I basically get a file everyday that has all the numbers I want to match to my GL's(General Ledger accounts-accounting stuff.
So, the file only contains one set of the data- all the numbers after replace. the long numbers is what I want this macro to convert it to but I also want to leave the original number in col A my replace to number in col. B.
Any help Is greatly appreciated
I seem unable to find a way to first copy n paste say Column B:B to sheet2 say A:A (I do this fine lol)
Then I want to run a find and replace on Sheet1 col b:b without the find & replace doing the same thing to sheet2.
As I want to then copy sheet2 a:a to sheet1 a:a to create my cross reference.
This I what I have
The first part is deleting rows I do not need. Rows with 0.
Sub sbDelete_Rows_Based_On_Multiple_Criteria()
'''''''''''''''
'FICS MA ENTRY'
'''''''''''''''
Sheets("1").Select
Dim lRow As Long
Dim iCntr As Long
lRow = 20000
For iCntr = lRow To 1 Step -1
If Cells(iCntr, 6) = 0 And Trim(Cells(iCntr, 7)) = 0 Then
Rows(iCntr).Delete
End If
Next
Columns("C:D").Delete
Range("B:B").Copy Destination:=Sheets("2").Range("A:A")
With Worksheets("1").Range("b:b")
.Replace "8000052", "80000260000-1"
.Replace "800162", "80000620000-2"
.Replace "809018", "80900180000-3"
.Replace "111026", "11440500000-4"
.Replace "131029", "6100010000-5"
.Replace "703010", "70400020000-6"
.Replace "703011", "70300010000-7"
.Replace "703013", "70300020000-8"
End With
End Sub
I have a lot more of these references but If I can get this to work - I could do the rest.
I also tried .range("b:b").replace....... it works but it changes my info on sheet two which I want to preserve
I basically get a file everyday that has all the numbers I want to match to my GL's(General Ledger accounts-accounting stuff.
So, the file only contains one set of the data- all the numbers after replace. the long numbers is what I want this macro to convert it to but I also want to leave the original number in col A my replace to number in col. B.
Any help Is greatly appreciated