Copy paste problem from one cell to another

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Hey Guys,
Good Morning,

Following is the suprising code for mi.
The reason for suprising b'coz, the same code sometimes run and this code want itself to not run.
I didnt understand what this expected ffrom mi.
Fine..

I just simply copy and paste the value from one cell to another.
Col l contains - no. of values wherein, it also contains value named "PB".

now where ever col L contains "PB" it should get cut and paste to respective cell of Col M.

The following is the code only. But didint understand Y getting error.

And this error continuosly coming, pls any one kindly explain me Y this error coming
Run time error '1004'
Method 'Range' of object '_Global failed


Public Function FindJB()
Dim i
Dim j
i = Range("L11" & Rows.Count).End(xlUp).Row
'For i = 11 To Range("L11").End(xlDown).Row
For j = 11 To i
If Left(Cells(j, 12), 2) = "JB" Then
Cells(j, 13).Value = Left(Cells(j, 12), 2).Value
'If Cells(i, 13).Value <> "" Then
Cells(j, 12).Value = ""
'End If
End If
Next
End Function
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Perhaps you meant the following?
Code:
i = Cells(Rows.Count, 12).End(xlUp).Row
But you should then check that 'i' is not less than 11.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,152
Members
452,891
Latest member
JUSTOUTOFMYREACH

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