Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default pasting data in different columns

hello evrybody.......

i m trying to fix this prblem for last few days

i have data in col.A , col.B,
say i hav 10 values [in cloumns above]
and wat i wanted to do with these values is to copy in different
columns "based on condition"

"My conditions is "

For Each r In myRange
d = Sqr((r.Value - r.Offset(-1, 0).Value) ^ 2 + (r.Offset(0, 1).Value
-
r.Offset(-1, 1).Value) ^ 2)
If Abs(d) 10 Then
then copy them to col.C, col.D and so on

say if first 5 values satisfy that condition then copy them to col.C,
col.D

NOW if 6 value donot satsfi the condition then copy it to columnE n
the condition is satisfied upto 8 value so copy the value of colA ,
colB in =====ColE,ColF

again 9 value do not satisfy copy it to next column ColmnG , ColH

hope i get some help from this forum
waiting 4 ur replys
Many thanx in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default pasting data in different columns

Sub splitcol()

LastRowC = Cells(Rows.Count, "C").End(xlUp).Row + 1
LastRowE = Cells(Rows.Count, "E").End(xlUp).Row + 1

d = Sqr((r.Value - r.Offset(-1, 0).Value) ^ 2 + _
(r.Offset(0, 1).Value - r.Offset(-1, 1).Value) ^ 2)
If Abs(d) 10 Then
Cells(LastRowC, "C") = r.Offset(-1, 1).Value
Cells(LastRowC, "D") = r.Value
Else
Cells(LastRowE, "E") = r.Offset(-1, 1).Value
Cells(LastRowE, "F") = r.Value

End If


End Sub


" wrote:

hello evrybody.......

i m trying to fix this prblem for last few days

i have data in col.A , col.B,
say i hav 10 values [in cloumns above]
and wat i wanted to do with these values is to copy in different
columns "based on condition"

"My conditions is "

For Each r In myRange
d = Sqr((r.Value - r.Offset(-1, 0).Value) ^ 2 + (r.Offset(0, 1).Value
-
r.Offset(-1, 1).Value) ^ 2)
If Abs(d) 10 Then
then copy them to col.C, col.D and so on

say if first 5 values satisfy that condition then copy them to col.C,
col.D

NOW if 6 value donot satsfi the condition then copy it to columnE n
the condition is satisfied upto 8 value so copy the value of colA ,
colB in =====ColE,ColF

again 9 value do not satisfy copy it to next column ColmnG , ColH

hope i get some help from this forum
waiting 4 ur replys
Many thanx in advance


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default pasting data in different columns

Thnx Mr Joel

For ur reply, ur effort n spending valuable time for me

actually this not wat i want to do , ur code worked fine its puting
data in "c" &"d" but my requiremnts are different

i hav around 2000 values in columns "a and b" now wat i wanted to do i
m xplaining here once again
my values are lik this

"D"= Sqr((r.Value - r.Offset(-1, 0).Value) ^ 2 + (r.Offset(0,
1).Value - r.Offset(-1, 1).Value) ^ 2)

that say 1-90 values hav "D" < 10 so put them in col "c & d" now 90
and 91 values have "D" 10
so i want value to b pasted in col "e" & "f' again when i compare 91
with 92 it returns "D" < 10 and it follws upto say 140
i want all these 91-140 value in col" e" & "f" and a loop which fill
values in other columns g,h,i,j.....til alll 2000 values get cheked
and pasted.

many thanx




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default pasting data in different columns

You are still not very clear in specifying your requirements. I think you
are looking to sort the values based on d and put the results inot differntt
columns based on the sort. what is not clear is how big each sort range is
goiing to be. The first size is 90 items 1-90, then the 2nd set is only 50,
91-140. You can't have both.

" wrote:

Thnx Mr Joel

For ur reply, ur effort n spending valuable time for me

actually this not wat i want to do , ur code worked fine its puting
data in "c" &"d" but my requiremnts are different

i hav around 2000 values in columns "a and b" now wat i wanted to do i
m xplaining here once again
my values are lik this

"D"= Sqr((r.Value - r.Offset(-1, 0).Value) ^ 2 + (r.Offset(0,
1).Value - r.Offset(-1, 1).Value) ^ 2)

that say 1-90 values hav "D" < 10 so put them in col "c & d" now 90
and 91 values have "D" 10
so i want value to b pasted in col "e" & "f' again when i compare 91
with 92 it returns "D" < 10 and it follws upto say 140
i want all these 91-140 value in col" e" & "f" and a loop which fill
values in other columns g,h,i,j.....til alll 2000 values get cheked
and pasted.

many thanx





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default pasting data in different columns

One idea/logic to approach this problem but unable to programme it as
i am a novice

1] why dont we insert an empty cell above the value which gives
whenevr "D" 10

"D" = Sqr((r.Value - r.Offset(-1, 0).Value) ^ 2 + (r.Offset(0,
1).Value - r.Offset(-1, 1).Value) ^ 2)

say if "D" = 11 for cell a90 , b90 & a 91 , b91 value......then insert
cell above a91 and b 91

similarly wherevr we get "d" 10

2} Now the second part, copy all the value before first empty cel
occurs say in row a91 empty cell ocurs so code shud copy all values
above empty cell n paste the a1:b91 values in col.c n col.d [c1:d91]

like wise if again empty cell occur at a140 then copy values from
a92:b139 n paste them to col .e & col.f [E1:F47]

i hop now the prblem its quite clear plz suggest some vba code/ideas
if u hav n some sites from wher i can learn such kinda code

many thanx



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default pasting data in different columns

the header row approach is an excellent suggestion. i did something like
that for somebody last weekend.

" wrote:

One idea/logic to approach this problem but unable to programme it as
i am a novice

1] why dont we insert an empty cell above the value which gives
whenevr "D" 10

"D" = Sqr((r.Value - r.Offset(-1, 0).Value) ^ 2 + (r.Offset(0,
1).Value - r.Offset(-1, 1).Value) ^ 2)

say if "D" = 11 for cell a90 , b90 & a 91 , b91 value......then insert
cell above a91 and b 91

similarly wherevr we get "d" 10

2} Now the second part, copy all the value before first empty cel
occurs say in row a91 empty cell ocurs so code shud copy all values
above empty cell n paste the a1:b91 values in col.c n col.d [c1:d91]

like wise if again empty cell occur at a140 then copy values from
a92:b139 n paste them to col .e & col.f [E1:F47]

i hop now the prblem its quite clear plz suggest some vba code/ideas
if u hav n some sites from wher i can learn such kinda code

many thanx


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default pasting data in different columns

hi mr .joel thanx for ur reply

but wil u plz tel me the code u did last week

i m novice n using my logic and trying to put it programming
but i m begineer so unable to programme it as a whole

hope u wil find some time to post it
any help wil b realy aapreciable

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
Pasting data with hidden columns shark1966 Excel Worksheet Functions 4 November 4th 06 04:00 AM
Pasting columns Manoj Excel Discussion (Misc queries) 0 October 12th 06 02:59 PM
Copy and pasting on columns but on spreadsheet with alot of data Michael Excel Discussion (Misc queries) 2 October 10th 06 01:49 PM
Pasting Columns Humbertt Excel Discussion (Misc queries) 2 September 15th 05 09:52 PM
Pasting on Filtered Data Sheets without pasting onto hidden cells CCSMCA Excel Discussion (Misc queries) 1 August 28th 05 01:22 PM


All times are GMT +1. The time now is 10:11 PM.

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

About Us

"It's about Microsoft Excel"