Run time error when copy pasting data

ssbhatban

New Member
Joined
Oct 20, 2015
Messages
37
Dear friends
I have created a sheet for database containing macro which also does data validation for blank cells. It is working fine when I am doing manual entry. But when I do copy paste from another sheet it gives runtime error ' type mismatch 13, end or debug option'
I need to do copy paste as it is not possible to enter manually. I am using ' change by value' process for work sheet
Is there any vba code to over come problem
Thanks
 

mole999

Moderator
Joined
Oct 23, 2004
Messages
9,899
what is the macro you use for validating, is it triggered when you paste the data ?
 

ssbhatban

New Member
Joined
Oct 20, 2015
Messages
37
what is the macro you use for validating, is it triggered when you paste the data ?
dear friend

I am using this code to delete value in next columns if the column B is blank

Private Sub Worksheet_Change(ByVal Target As Range)

' If target column is B, ( Name ) is below the header row AND it's new value is blank then clear (Reg. no) C...
If Target.Column = 2 And Target.Row > 1 And Target.Value = "" Then
' Clear contents of column C
Target.Offset(0, 1).ClearContents
End If

and also i am making sure that column B is entered before column C is entred
If Target.Count > 1 Then Exit Sub
If Target.Value <> "" Then
If Not Intersect(Target, Range("C:C")) Is Nothing Then
If Target.Offset(, -1).Value = "" Then
Target.Value = ""
MsgBox " Enter Name "
Target.Offset(, -1).Select
End If
End If
End If

every thing is working fine when i am entering manually. but when i copy from other sheets i am getting error. even i a getting " run time error - 13 , type mis match " when i selec more that one data in the same column & deleted. is there any way to send the screen shot to you?
 

ssbhatban

New Member
Joined
Oct 20, 2015
Messages
37
dear friend

I am using this code to delete value in next columns if the column B is blank

Private Sub Worksheet_Change(ByVal Target As Range)

' If target column is B, ( Name ) is below the header row AND it's new value is blank then clear (Reg. no) C...
If Target.Column = 2 And Target.Row > 1 And Target.Value = "" Then
' Clear contents of column C
Target.Offset(0, 1).ClearContents
End If

and also i am making sure that column B is entered before column C is entred
If Target.Count > 1 Then Exit Sub
If Target.Value <> "" Then
If Not Intersect(Target, Range("C:C")) Is Nothing Then
If Target.Offset(, -1).Value = "" Then
Target.Value = ""
MsgBox " Enter Name "
Target.Offset(, -1).Select
End If
End If
End If

every thing is working fine when i am entering manually. but when i copy from other sheets i am getting error. even i a getting " run time error - 13 , type mis match " when i selec more that one data in the same column & deleted. is there any way to send the screen shot to you?
Hi solved thanks
 

Forum statistics

Threads
1,082,382
Messages
5,365,128
Members
400,825
Latest member
Sreekanth_21

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top