Don Carlos
New Member
- Joined
- Feb 1, 2016
- Messages
- 5
Excel 2010 VBA
My intention is to copy cell text value (containing a list of information provided by the user) and paste it to two different cells. The intent is to allow the user to edit the record within a userform. If the two text values are not equal, I would enable the "save" and "discard" changes buttons within the userform.
The coding instructions are below:
The issue is that the "RISKIMP1" and "RISKIMP2" contents are different causing the "save" and "discard" buttons to be enabled when actually no change was made by the user. I checked the contents using a basic text editor and the contents are the same between the two different cells.
I have tried:
1. using TRIM() and still the length of the cell values are different by 2 characters;
2. using LEFT() and taking the shorter length and comparing the trimmed values;
3. copying the formats of a different cell onto the ones in question;
4. as the longer length goes to the first cell, I wrote to three cells and compared the last two with the second cell being the same as the first;
5. wrote contents to three cells and compared the first two; and
5. copied the userform, sheet2 and sheet4 contents into a new spreadsheet.
Your feedback on options are appreciated.
My intention is to copy cell text value (containing a list of information provided by the user) and paste it to two different cells. The intent is to allow the user to edit the record within a userform. If the two text values are not equal, I would enable the "save" and "discard" changes buttons within the userform.
The coding instructions are below:
Code:
tTempText = Trim(Sheet4.Range("RISKNW").Offset(nSelectedRecord, 13).Value)
Sheet2.Range("RISKIMP1").Value = tTempText
Sheet2.Range("RISKIMP2").Value = tTempText
The issue is that the "RISKIMP1" and "RISKIMP2" contents are different causing the "save" and "discard" buttons to be enabled when actually no change was made by the user. I checked the contents using a basic text editor and the contents are the same between the two different cells.
I have tried:
1. using TRIM() and still the length of the cell values are different by 2 characters;
2. using LEFT() and taking the shorter length and comparing the trimmed values;
3. copying the formats of a different cell onto the ones in question;
4. as the longer length goes to the first cell, I wrote to three cells and compared the last two with the second cell being the same as the first;
5. wrote contents to three cells and compared the first two; and
5. copied the userform, sheet2 and sheet4 contents into a new spreadsheet.
Your feedback on options are appreciated.