I have the following code (from the macro recorder)
Sub Macro3()
Range("A1").Select
ActiveCell.FormulaR1C1 = _
"blahisfgkjdfgvhdzlghfdzgkljdfzghkldfzghdkgh[String to Find]xfkdfhgfdkghfcklgfdlogjud"
Range("F6").Select
ActiveSheet.Paste
End Sub
When I recorded the macro I double clicked cell A1, highlighted "String to Find", and pressed CTRL+C. When I run this macro it pastes "String to Find" to cell F6.
Now though, I need to edit the code to make it work for my purposes. I tried the following:
Sub Macro3()
Range("A1").Select
Contents = Cell.Value
ActiveCell.FormulaR1C1 = Contents
Range("F6").Select
ActiveSheet.Paste
End Sub
As one would imagine, it pastes "blahisfgkjdfgvhdzlghfdzgkljdfzghkldfzghdkgh[String to Find]xfkdfhgfdkghfcklgfdlogjud" to cell F6.
The only difference I know of in the code is the underscore at the beginning of the string for the macro recorder version (line 4). All I would like to do is read in "String to Find" from selected cell A1 to a variable. Does anyone have any assistance here?
Sub Macro3()
Range("A1").Select
ActiveCell.FormulaR1C1 = _
"blahisfgkjdfgvhdzlghfdzgkljdfzghkldfzghdkgh[String to Find]xfkdfhgfdkghfcklgfdlogjud"
Range("F6").Select
ActiveSheet.Paste
End Sub
When I recorded the macro I double clicked cell A1, highlighted "String to Find", and pressed CTRL+C. When I run this macro it pastes "String to Find" to cell F6.
Now though, I need to edit the code to make it work for my purposes. I tried the following:
Sub Macro3()
Range("A1").Select
Contents = Cell.Value
ActiveCell.FormulaR1C1 = Contents
Range("F6").Select
ActiveSheet.Paste
End Sub
As one would imagine, it pastes "blahisfgkjdfgvhdzlghfdzgkljdfzghkldfzghdkgh[String to Find]xfkdfhgfdkghfcklgfdlogjud" to cell F6.
The only difference I know of in the code is the underscore at the beginning of the string for the macro recorder version (line 4). All I would like to do is read in "String to Find" from selected cell A1 to a variable. Does anyone have any assistance here?