Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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/ |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Show formulas result + text directly | Excel Worksheet Functions | |||
Opening format options directly | Charts and Charting in Excel | |||
Pasting delimited text from clipboard directly into Excel Spreadsh | New Users to Excel | |||
Date format not correct when you convert a CSV text file in Excel | Excel Discussion (Misc queries) | |||
why can't I place the cursor directly on certain cells? | Excel Discussion (Misc queries) |