I’m using a macro to clear a range of cells If I use clear or clear contents my macro doesn’t work anymore. If I use the delete key on the keyboard and paste other values into those cells then the macro works. Can’t figure out why?
I’m using a macro to clear a range of cells If I use clear or clear contents my macro doesn’t work anymore. If I use the delete key on the keyboard and paste other values into those cells then the macro works. Can’t figure out why?
Peace of mind is found in some of the strangest places.
Please show your macro and tell us on what line you get which error exactly.
the macro runs fine. Here is what I’m doing.
I copy and paste from a csv workbook into a macro enabled workbook. In the code there is a line that changes the csv to double (CDbl). Like I said it works fine the first pass and also works if you use the delete key to delete the data and replace it with new csv data.
I created a macro that that clears the data from a actixeX button. This is where the problem comes in. If I use ClrarContents or Clear the paste the csv data and run the macro it does not find matches but it should.
So the question is why does the macro run correctly when you use the delete key to clear the contents but if you use the macro to clear contents the next time you paste the data and run the macro no matching data is found. To me delete key or clear or clear contents is the same. But obviously not.
Peace of mind is found in some of the strangest places.
Hi austenr. I see the CDbl code revision worked. Maybe post your macro that you're using to clear/delete the data. Dave
basically just that 1 line. Also tried clear contents.Private Sub CommandButton1_Click() Range("a2:a1000").ClearContents End Sub
I would also like a way to copy cells in column A that have an X in column B which indicates a match to E8 and all subsequent matches on down so the user doesnt have to scroll down all the way. I know there is an offset way of doing it but cant get it to work.
Peace of mind is found in some of the strangest places.
Maybe just append some code to the previous code. Where do U want to list the matches? U need to qualify your clear...
DaveDim LastRow As Integer 'clear "A" With Sheets("Sheet1") LastRow = .Range("A" & .Rows.Count).End(xlUp).Row .Range("A" & "1:A" & LastRow).Clear End With
You have so little knowledge of VBA that anything is possible in 'your' code.
My compliments for not uploading your workbook and preventing others to help you.
hello dave the matches should start in E8. as for the response from snb sometimes its better to say nothing and move on to the next thread instead of trying to belittle someone.
Peace of mind is found in some of the strangest places.
"You have so little knowledge of VBA that anything is possible in 'your' code." ????? snb seems like you were referring to me but I'm guessing U were just funning with austenr. I'll pm austenr with anything further. Dave
@Dave the you in the second line is the same you in the first one (i.e. not you)
Brrrr. Too lazy to use F1.Also tried clear contents.