Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Show formulas result + text directly veggies27 Excel Worksheet Functions 3 March 20th 08 03:27 AM
Opening format options directly SalD Charts and Charting in Excel 1 November 16th 07 12:39 PM
Pasting delimited text from clipboard directly into Excel Spreadsh Anexceluser New Users to Excel 2 February 11th 07 01:57 AM
Date format not correct when you convert a CSV text file in Excel Scarab Excel Discussion (Misc queries) 2 November 16th 05 12:22 PM
why can't I place the cursor directly on certain cells? KG Excel Discussion (Misc queries) 3 January 31st 05 11:26 PM


All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"