Hello
I am trying to adjust an export code written by someone else in which the data being exported is the same but the reference location for the data (sheets, rows, and cells) has changed. It would be helpful to know what the code is instructing the macro to do in each line. Specifically what A=3 To 11 means. If Cells(L,A) means row 11 and column 3? Note: L = 11 To 33 portion of the code, I was able to adjust successfully.
here is a clip of the working export file and what the finished product should look like
I am trying to adjust an export code written by someone else in which the data being exported is the same but the reference location for the data (sheets, rows, and cells) has changed. It would be helpful to know what the code is instructing the macro to do in each line. Specifically what A=3 To 11 means. If Cells(L,A) means row 11 and column 3? Note: L = 11 To 33 portion of the code, I was able to adjust successfully.
VBA Code:
For L = 11 To 33
Sheets("MME").Select
numalleles = Application.WorksheetFunction.CountA(Range(Cells(L, 3), Cells(L, 11)))
If numalleles > 0 Then
Sheets("Export").Cells(Exportrow, 1) = "<LOCUS>"
Exportrow = Exportrow + 1
Sheets("Export").Cells(Exportrow, 1) = " <LOCUSNAME>" & Sheets("MME").Cells(L, 2) & "</LOCUSNAME>"
Exportrow = Exportrow + 1
Sheets("Export").Cells(Exportrow, 1) = " <READINGBY>" & user & "</READINGBY>"
Exportrow = Exportrow + 1
Sheets("Export").Cells(Exportrow, 1) = " <READINGDATETIME>" & yr & "-" & mn & "-" & dd & "T" & hr & ":" & mi & ":" & sc & "</READINGDATETIME>"
Exportrow = Exportrow + 1
For A = 3 To 11
If Sheets("MME").Cells(L, A) > 0 Then
Allele = Sheets("MME").Cells(L, A)
Allele = Replace(Allele, "<", "<")
Allele = Replace(Allele, ">", ">")
If A = 3 Then
Sheets("Export").Cells(Exportrow, 1) = " <ALLELE ALLELEREQUIRED = " & Chr(34) & "1" & Chr(34) & " > "
Exportrow = Exportrow + 1
Sheets("Export").Cells(Exportrow, 1) = " <ALLELEVALUE>" & Allele & "</ALLELEVALUE>"
Exportrow = Exportrow + 1
Sheets("Export").Cells(Exportrow, 1) = " </ALLELE>"
Exportrow = Exportrow + 1
Else
Sheets("Export").Cells(Exportrow, 1) = " <ALLELE>"
Exportrow = Exportrow + 1
Sheets("Export").Cells(Exportrow, 1) = " <ALLELEVALUE>" & Allele & "</ALLELEVALUE>"
Exportrow = Exportrow + 1
Sheets("Export").Cells(Exportrow, 1) = " </ALLELE>"
Exportrow = Exportrow + 1
End If
End If
Next A
Sheets("Export").Cells(Exportrow, 1) = "</LOCUS>"
Exportrow = Exportrow + 1
End If
Next L
here is a clip of the working export file and what the finished product should look like