PC Review


Reply
Thread Tools Rate Thread

coping cells

 
 
=?Utf-8?B?SkpNTlo3Ng==?=
Guest
Posts: n/a
 
      5th Oct 2006
Saludos...

What would the code in vba be for the following , Kind of new vba and stil
haven't got the hang of loops.

I have a sheet the looks like the following. How can I make it so it copies
CODE1 in the blank cells till it reaches code2 , then copy code 2 in the
blank cells between code2 and 3 and so on.

a b c
Code 1 Juan 22 days
Pedro 14 hrs
Luis 15 day

Code 2 Juan 5 days
Pedro 3 hrs
Luis 2 day

Code 3 Juan 2 days

and so on.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      5th Oct 2006
You can do it pretty easily by hand... Assuming Code 1 is in Cell A1 add this
formula to A2 =if(b2<>"", A1, ""). Now copy Cell A2. Highlight A1:A100 (or
however far you need to go) and hit F5 ->Special Cells -> Blanks -> OK (all
of the blanks in A1:A100 will now be selected) Paste the formula into the
blanks... Now Copy column A and paste speacial values. if you need a macro to
do this just record your actions while you do it...
--
HTH...

Jim Thomlinson


"JJMNZ76" wrote:

> Saludos...
>
> What would the code in vba be for the following , Kind of new vba and stil
> haven't got the hang of loops.
>
> I have a sheet the looks like the following. How can I make it so it copies
> CODE1 in the blank cells till it reaches code2 , then copy code 2 in the
> blank cells between code2 and 3 and so on.
>
> a b c
> Code 1 Juan 22 days
> Pedro 14 hrs
> Luis 15 day
>
> Code 2 Juan 5 days
> Pedro 3 hrs
> Luis 2 day
>
> Code 3 Juan 2 days
>
> and so on.

 
Reply With Quote
 
acampbell012@yahoo.com
Guest
Posts: n/a
 
      5th Oct 2006
Just modify ranges as needed:

Sub SameAsAbove()
'Copies data from cell above if current cell in range is blank
Dim MyRange As Range
Dim MyCell As Range
Dim Endrow As Integer
Endrow = Range("A65536").End(xlUp).Row
Set MyRange = Range("A1:G" & Endrow)
MyRange.Select
On Error Resume Next
For Each MyCell In MyRange
If MyCell.Value = "" Then
MyCell.Value = MyCell.Offset(-1, 0).Value
End If
Next MyCell
End Sub

JJMNZ76 wrote:
> Saludos...
>
> What would the code in vba be for the following , Kind of new vba and stil
> haven't got the hang of loops.
>
> I have a sheet the looks like the following. How can I make it so it copies
> CODE1 in the blank cells till it reaches code2 , then copy code 2 in the
> blank cells between code2 and 3 and so on.
>
> a b c
> Code 1 Juan 22 days
> Pedro 14 hrs
> Luis 15 day
>
> Code 2 Juan 5 days
> Pedro 3 hrs
> Luis 2 day
>
> Code 3 Juan 2 days
>
> and so on.


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      5th Oct 2006
Debra Dalgleish has some techniques:
http://www.contextures.com/xlDataEntry02.html



JJMNZ76 wrote:
>
> Saludos...
>
> What would the code in vba be for the following , Kind of new vba and stil
> haven't got the hang of loops.
>
> I have a sheet the looks like the following. How can I make it so it copies
> CODE1 in the blank cells till it reaches code2 , then copy code 2 in the
> blank cells between code2 and 3 and so on.
>
> a b c
> Code 1 Juan 22 days
> Pedro 14 hrs
> Luis 15 day
>
> Code 2 Juan 5 days
> Pedro 3 hrs
> Luis 2 day
>
> Code 3 Juan 2 days
>
> and so on.


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?SkpNTlo3Ng==?=
Guest
Posts: n/a
 
      5th Oct 2006
Thanks to all,

"Dave Peterson" wrote:

> Debra Dalgleish has some techniques:
> http://www.contextures.com/xlDataEntry02.html
>
>
>
> JJMNZ76 wrote:
> >
> > Saludos...
> >
> > What would the code in vba be for the following , Kind of new vba and stil
> > haven't got the hang of loops.
> >
> > I have a sheet the looks like the following. How can I make it so it copies
> > CODE1 in the blank cells till it reaches code2 , then copy code 2 in the
> > blank cells between code2 and 3 and so on.
> >
> > a b c
> > Code 1 Juan 22 days
> > Pedro 14 hrs
> > Luis 15 day
> >
> > Code 2 Juan 5 days
> > Pedro 3 hrs
> > Luis 2 day
> >
> > Code 3 Juan 2 days
> >
> > and so on.

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
coping cell contains to different cells TK Microsoft Excel Discussion 3 19th Feb 2010 05:57 PM
Please help with coping cells =?Utf-8?B?QWw=?= Microsoft Excel Programming 4 21st Sep 2007 06:24 PM
Coping ranges of cells David Microsoft Excel Programming 4 2nd Jul 2007 07:12 AM
Coping info inside cells Hinojosa Microsoft Excel Programming 6 22nd Nov 2006 11:54 PM
Coping all cells with data. Pete Microsoft Excel Programming 0 8th Jan 2004 09:40 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:03 AM.