Copy value

  • Thread starter Thread starter gary
  • Start date Start date
G

gary

If B4 contains the same number as A3, how can I put the number in A4?

Here is my spreadsheet:

A B
1 0082766
2 0082767
3 0082768 0082768
4 0082768
5 0082768
6 0082768
7 0082768
8 0104361
9 0104365
10 0104367
11 0104368
12 0104370
13 0104409 0104409
14 0104409


=========


This is the result I'm looking for:


A B
1 0082766
2 0082767
3 0082768 0082768
4 0082768 0082768
5 0082768 0082768
6 0082768 0082768
7 0082768 0082768
8 0104361
9 0104365
10 0104367
11 0104368
12 0104370
13 0104409 0104409
14 0104409 0104409
 
If B4 contains the same number as A3, how can I put the number in A4?

Here is my spreadsheet:

             A                B
  1                     0082766
  2                     0082767
  3    0082768   0082768
  4                     0082768
  5                     0082768
  6                     0082768
  7                     0082768
  8                     0104361
  9                     0104365
10                     0104367
11                     0104368
12                     0104370
13   0104409    0104409
14                     0104409

=========

This is the result I'm looking for:

           A                B
  1                     0082766
  2                     0082767
  3    0082768   0082768
  4    0082768   0082768
  5    0082768   0082768
  6    0082768   0082768
  7    0082768   0082768
  8                     0104361
  9                     0104365
10                     0104367
11                     0104368
12                     0104370
13   0104409    0104409
14   0104409    0104409

You posted in misc and I gave you a macro that was TESTED and DOES
work.
You said "it didn't work"
What does " it didn't work" mean. I tested. All you had to do was
change
mc = 2 to whatever column you are testing.

Sub copynumbersif()
Dim mc As Long
Dim i As Long
mc = 2
For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row
If Cells(i - 1, mc) = Cells(i, mc) Then
Cells(i - 1, mc - 1) = Cells(i, mc)
Cells(i, mc - 1) = Cells(i, mc)
End If
Next i
End Sub
 
Go 'horns


Gord

You posted in misc and I gave you a macro that was TESTED and DOES
work.
You said "it didn't work"
What does " it didn't work" mean. I tested. All you had to do was
change
mc = 2 to whatever column you are testing.

Sub copynumbersif()
Dim mc As Long
Dim i As Long
mc = 2
For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row
If Cells(i - 1, mc) = Cells(i, mc) Then
Cells(i - 1, mc - 1) = Cells(i, mc)
Cells(i, mc - 1) = Cells(i, mc)
End If
Next i
End Sub
 
Go 'horns

Gord





- Show quoted text -

Here's more of my spreadsheet:


A B
0082655
0082657
0082657
0082657
0082669
0082669
0082669
0082698
0082698
0082698
0082715
0082715
0082715
0082716
0082716
0082716
0082717
0082717
0082717
0082728
0082728
0082728
0082763
0082765
0082765
0082765
0082766
0082767
0082768 0082768
0082768
0082768
0082768
0082768
0082769 0082769
0082769
0082769
0082769
0082769
0082770 0082770
0082770
0082770
0082770
0082770
0082771 0082771
0082771
0082771
0082771
0082771
0082789
0082789
0082789
0082793
0082794
0082795
0082796
0082797
0082797
0082797
0082800
0082800
0082800
0082811
0082811
0082811
0083855
0083859
0083859
0083859
0083864
0083864
0083865
0083865
0083865
0083867
0083867
0083868
0083868
0083868
0083870
0083873
0083873
0083874
0083874
0083874
0083875
0083875
0083875
0083876
0083876
0083876
0083877
0083877
0083877
0083878
0083878
0083878
0083879
0083879
0083879
0083880
0083880
0083880
0083881
0083881
0083881
0083882
0083882
0083882
0083883
0083884
0083884

In col A, only these numbers should appear (each 4 times):

0082768
0082769
0082770
0082771
 
Go 'horns

Gord





- Show quoted text -

========================================

Here's more of my spreadsheet:

A B
0082655
0082657
0082657
0082657
0082669
0082669
0082669
0082698
0082698
0082698
0082715
0082715
0082715
0082716
0082716
0082716
0082717
0082717
0082717
0082728
0082728
0082728
0082763
0082765
0082765
0082765
0082766
0082767
0082768 0082768
0082768
0082768
0082768
0082768
0082769 0082769
0082769
0082769
0082769
0082769
0082770 0082770
0082770
0082770
0082770
0082770
0082771 0082771
0082771
0082771
0082771
0082771
0082789
0082789
0082789
0082793
0082794
0082795
0082796
0082797
0082797
0082797
0082800
0082800
0082800
0082811
0082811
0082811
0083855
0083859
0083859
0083859
0083864
0083864
0083865
0083865
0083865
0083867
0083867
0083868
0083868
0083868
0083870
0083873
0083873
0083874
0083874
0083874
0083875
0083875
0083875
0083876
0083876
0083876
0083877
0083877
0083877
0083878
0083878
0083878
0083879
0083879
0083879
0083880
0083880
0083880
0083881
0083881
0083881
0083882
0083882
0083882
0083883
0083884
0083884


In col A, only these numbers should appear (each 5 times):


0082768
0082769
0082770
0082771
 
Go 'horns

Gord

Gord, Thanks. Looks like the University of Texas football team is on
the right track back and will be playing "power football" . BTW,it's
"Hook em horns" Come see me in Austin.
 
"Hook 'em horns"

I'll remember that Don.

Not much chance of me getting to Austin.

With my list of health issues over the past 6 years my travel
insurance cost could equal your national debt.
 
Back
Top