How can I format text pased directly from clipboard to appear in correct cells
I am an educator working on an excel gradebook. I have finished
everything except an automatic formatting routine when I paste my student roster, which is directly from the web to the clipboard. I've tried to use a control button and code it with the appropriate VBA. I need to move some cells around based on certain conditions. The problem is that some students don't have middle initials, so that column contains data that should be in the next field for those cases where a student has no middle initial. I've tried to use conditional statements to accomplish this. For example, my logic was if the cell had length greater than one, then it was clearly not a middle initial and the data from that point on must be shifted to the right in that row. I tried the following, which didn't work. If Len(e4) 1 Then Range("E4:F4").Select Selection.Copy Range("F4").Select ActiveSheet.Paste Range("E4").Select Selection.ClearContents End If Can anyone help me accomplish this? Thank you in advance. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
How can I format text pased directly from clipboard to appear in correct cells
Pbase,
Try If Len(Range("E4").Value) 1 Then Range("E4:F4").Copy Destination:= Range("F4") Range("E4").ClearContents End If "pbase" wrote in message ... I am an educator working on an excel gradebook. I have finished everything except an automatic formatting routine when I paste my student roster, which is directly from the web to the clipboard. I've tried to use a control button and code it with the appropriate VBA. I need to move some cells around based on certain conditions. The problem is that some students don't have middle initials, so that column contains data that should be in the next field for those cases where a student has no middle initial. I've tried to use conditional statements to accomplish this. For example, my logic was if the cell had length greater than one, then it was clearly not a middle initial and the data from that point on must be shifted to the right in that row. I tried the following, which didn't work. If Len(e4) 1 Then Range("E4:F4").Select Selection.Copy Range("F4").Select ActiveSheet.Paste Range("E4").Select Selection.ClearContents End If Can anyone help me accomplish this? Thank you in advance. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 12:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com