Need help to autofil with VBA

elmnas

Board Regular
Joined
Feb 20, 2015
Messages
206
Hi all Excel Members,






I have a function that checks if the text content in two textcells on same row on column J and column K is the same.
when two equal cells find same row (column J and column K), go to Column A check which number is (for example, in this case, "34234") select column B the same row "12" then comes a math formula, that ads a new value in Column T same row,
I want now
Autofil in this example the value "7" in all rows on column T to the first instance of (34234(there can by over 100000 numbers))


I got this code so far
Code:
For i = 2 To ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
    If Cells(i, "J") = Cells(i, "K") And Len(Cells(i, "B")) <> 0 And Cells(i, "AB") <> 0 Then
       
    End If
Next i








End Sub




here is original file:




24SD2hm.png





Here is the result I want:



75TKnnl.png



Could someone help me out ?




Thank you in advance
 
Last edited:

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
my fault here is the correct code:

Code:
Sub CheckMatch()


' the code look in column J after a equal Value but in Column K and if found
' Set interior color index = yellow
' select Cell in Column B same row, - 1 then divide by sum from column AB then present a new result in Column T same row
For i = 2 To ActiveSheet.UsedRange.SpecialCells(xlCellTypeLastCell).Row
    If Cells(i, "J") = Cells(i, "K") And Len(Cells(i, "B")) <> 0 And Cells(i, "AB") <> 0 Then

'Dim DivAB As String


'Rows(i).Select

Cells(i, 1).EntireRow.Interior.ColorIndex = 6
'Cells(i, "B").Select
myCell = Cells(i, "B").Text
mycellRes = myCell - 1
DivAB = Cells(i, "AB").Text


myTot = Round(DivAB / mycellRes)
 ' presentera i kolumn T

'mycellSel = Cells(i, "T").Select
'ActiveCell.Value = myTot
Cells(i, 20) = myTot

'MsgBox myTot


    End If
Next i

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,988
Members
452,373
Latest member
TimReeks

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top