I'm realising that I'm clearly not a coder more and more every day I try, so would appreciate some help.
I have an excel worksheet that has unique and repetitive column headings. Row 1 in my mini-sheet is my raw column headings that I need to record into what I've posted in Row 2. What I'd like to do is, for certain values like "Timestamp Start Task" I'd like to incrementally relabel these T1_Starttime, T2_Starttime, etc. You'll see there are quite a few that I need to incrementally relabel. There are others that I just need to relabel which I think I can figure out, but the loop part I cannot figure out for the life of me. If anyone is willing to help it would be appreciated, and if possible, I'd love to be able to do something along the lines of, if the column header in Row 1 is not changed as a part of the script then relabel those incrementally as "New value 1", "New value 2" etc.
What have I tried? Well I'm embarrassed as I've been adapting what I could find and this is the best I've gotten which hasn't worked ?
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long, j As Long, str0 As String, str1 As String, str2 As String, str3 As String
Set Rng = Range("A1:ZA1")
On Error GoTo ErrExit
i = 0
str0 = "Task success"
str1 = "T"
str2 = "_Effectiveness"
str3 = str1 & j & str2
On Error GoTo 0
With Rng.Select
Selection.Find(what:=str0, After:=("A1"), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End With
Do While .Find.Found
If .InRange(Rng) Then
.InsertAfter j + i
j = str3 + 1
.Find.Execute
Else
Exit Do
End If
Loop
End With
ErrExit:
Application.ScreenUpdating = True
MsgBox j & " verse references updated."
End Sub
I have an excel worksheet that has unique and repetitive column headings. Row 1 in my mini-sheet is my raw column headings that I need to record into what I've posted in Row 2. What I'd like to do is, for certain values like "Timestamp Start Task" I'd like to incrementally relabel these T1_Starttime, T2_Starttime, etc. You'll see there are quite a few that I need to incrementally relabel. There are others that I just need to relabel which I think I can figure out, but the loop part I cannot figure out for the life of me. If anyone is willing to help it would be appreciated, and if possible, I'd love to be able to do something along the lines of, if the column header in Row 1 is not changed as a part of the script then relabel those incrementally as "New value 1", "New value 2" etc.
What have I tried? Well I'm embarrassed as I've been adapting what I could find and this is the best I've gotten which hasn't worked ?
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long, j As Long, str0 As String, str1 As String, str2 As String, str3 As String
Set Rng = Range("A1:ZA1")
On Error GoTo ErrExit
i = 0
str0 = "Task success"
str1 = "T"
str2 = "_Effectiveness"
str3 = str1 & j & str2
On Error GoTo 0
With Rng.Select
Selection.Find(what:=str0, After:=("A1"), LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
End With
Do While .Find.Found
If .InRange(Rng) Then
.InsertAfter j + i
j = str3 + 1
.Find.Execute
Else
Exit Do
End If
Loop
End With
ErrExit:
Application.ScreenUpdating = True
MsgBox j & " verse references updated."
End Sub
junk.xlsx | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | AA | AB | AC | AD | AE | AF | AG | AH | AI | AJ | AK | AL | AM | AN | AO | AP | AQ | AR | AS | AT | AU | AV | AW | AX | AY | AZ | BA | BB | BC | BD | BE | |||
1 | For the first task, you are required to log-in to the system with credentials provided by the moderator. Then locate the MUIQ widget at bottom of the screen. Try expanding and minimising it, as well as moving it to a place you are comfortable with. | Task success | Total Task Time (sec) | Number of Clicks | Study Completed? | Number of Visited URLs | Plugin ID | Timestamp Task Start | Timestamp Task End | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [It is useful ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [It is user friendly ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I learned to use it quickly ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I am satisfied with it ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I am confident that I completed the task successfully] | Did you encounter any difficulty during this task? | Please rate the level of difficulty you experienced; where 1) is Not difficult at all and 7) is Very difficult. [undefined] | Please ask your moderator for the corresponding code: | Any comments you'd like to provide regarding the previous task? | Task1 group Time (sec) | Your company just rolled out Performance Analytics to your organization with new dashboards, and capabilities to help monitor Incidents. They created a new dashboard for you called Incident Management. Please find it and add it to your favorites. | Task success | Total Task Time (sec) | Number of Clicks | Study Completed? | Number of Visited URLs | Plugin ID | Timestamp Task Start | Timestamp Task End | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [It is useful ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [It is user friendly ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I learned to use it quickly ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I am satisfied with it ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I am confident that I completed the task successfully] | Did you encounter any difficulty during this task? | Please rate the level of difficulty you experienced; where 1) is Not difficult at all and 7) is Very difficult. [undefined] | Please ask your moderator for the corresponding code: | Any comments you'd like to provide regarding the previous task? | Task2 group Time (sec) | Using the Incident Management dashboard, please find the Open Incidents by Priority and determine the delta in critical incidents from yesterday. | Task success | Total Task Time (sec) | Number of Clicks | Study Completed? | Number of Visited URLs | Plugin ID | Timestamp Task Start | Timestamp Task End | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [It is useful ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [It is user friendly ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I learned to use it quickly ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I am satisfied with it ] | For the task you just completed, please indicate how strongly you agree with the following statements; where 1) is Strongly Disagree and 7) is Strongly Agree. [I am confident that I completed the task successfully] | Did you encounter any difficulty during this task? | Please rate the level of difficulty you experienced; where 1) is Not difficult at all and 7) is Very difficult. [undefined] | Please ask your moderator for the corresponding code: | Any comments you'd like to provide regarding the previous task? | Task3 group Time (sec) | ||
2 | T1_Task | T1_Effectiveness | T1_Time_task | T1_Clicks | T1_StudyComplete | T1_Urls | Deleteme | T1_Starttime | T1-Endtime | T1_Useful | T1_UserFriendly | T1_Learned | T1_Satisfied | T1_Confident | T1_Exp_Difficulty | T1_DifficultyLevel | T1_Pass_Fail | T1_Comments | T1_OverallTime | T2_Task | T2_Effectiveness | T2_Time_task | T2_Clicks | T2_StudyComplete | T2_Urls | Deleteme | T2_Starttime | T2_Endtime | T2_Useful | T2_UserFriendly | T2_Learned | T2_Satisfied | T2_Confident | T2_Exp_Difficulty | T2_DifficultyLevel | T2_Pass_Fail | T2_Comments | T2_OverallTime | T3_Task | T3_Effectiveness | T3_Time_task | T3_Clicks | T3_StudyComplete | T3_Urls | Deleteme | T3_Starttime | T3_Endtime | T3_Useful | T3_UserFriendly | T3_Learned | T3_Satisfied | T3_Confident | T3_Exp_Difficulty | T3_DifficultyLevel | T3_Pass_Fail | T3_Comments | T3_OverallTime | ||
Sheet3 |