Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Method of Copying my macro entries into the Editor faster I have a project where

ID: 640717 • Letter: M

Question

Method of Copying my macro entries into the Editor faster

I have a project where I have over 12 different text strings, each over 200 characters long and am trying to find a way to enter them faster into the macro I'm recording. They will eventually be read by several machine learning algorithms, so accuracy is key (why I'd like to eliminate human error via poor keystrokes from the process)

So, instead of typing each of the 12 entries character by character, I'd like to simply copy them from another spreadsheet where I'm certain they're correct and input them into the macro I'm recording. Does anyone know how I would achieve this?

Currently when I try to copy it in from another spreadsheet, the recorder registers the copy keystrokes as what I want to do (which makes sense), leading to an 'out of range' error.

Thanks !!

Explanation / Answer

Hi..

You should post the code that you need to modify, but, for example, you could do this if the values are in an open workbook named "File with Text Strings.xlsx" on a worksheet named "Strings to copy" in column A starting in row 1:

Dim strTS(1 to 12) As String

Dim i As Integer

For i = 1 To 12

strTS(i) = Workbooks("File with Text Strings.xlsx").Worksheets("Strings to copy").Cells(i,"A").Value

Next i

Then the strings are stored in strTS(1), strTS(2), etc.