Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Quick VB Help

I need help writing some vb script.... I know that it is
not that hard, I am just having a brain freeze today and
need help. Here is what I have... In Column A, every
couple of rows I have a "Identifier" then a couple of
rows of names (Column B) and I need to write code that
will Start at A2 (Or Active Cell) and Do a Select
(xlDown), Offset (-1,0) (Up one Row) and CopyDown, then
select then next identifier and do it again until the
end. For example, Cell A2 to A4 will copy down what is in
A2, A5 to A26 will copy down what is on A5, A27 to A47
will copy down what is in A27.

Thanks, April
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick VB Help

Try this:

lrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
For x = 2 To lrow
If Worksheets(1).Cells(x, 1).Value < "" Then
nam = Worksheets(1).Cells(x, 2).Value
y = x
Do
y = y + 1
Loop Until Worksheets(1).Cells(y + 1, 1).Value < "" Or _
y = lrow
For z = x + 1 To y
Worksheets(1).Cells(z, 2).Value = nam
Next z
End If
Next x

- Piku

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Quick VB Help

I have this:

Do
ActiveCell.Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.Offset(-1, 0)).Select
Selection.FillDown
Selection.End(xlDown).Select

Loop

The only problem is the offset(-1,0) is not working
right. Say it has A5:A10 Selected, instead of changing
it to A5:A9 with the Offset(-1,0) it is changing it to
A4:A10 or A5:A11, how do I get it to offset up one row
(From the bottom of the select and not from the top).

April
-----Original Message-----
Try this:

lrow = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count
For x = 2 To lrow
If Worksheets(1).Cells(x, 1).Value < "" Then
nam = Worksheets(1).Cells(x, 2).Value
y = x
Do
y = y + 1
Loop Until Worksheets(1).Cells(y + 1, 1).Value < "" Or _
y = lrow
For z = x + 1 To y
Worksheets(1).Cells(z, 2).Value = nam
Next z
End If
Next x

- Pikus


---
Message posted from http://www.ExcelForum.com/

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick VB Help

Did you try what I gave you? - Pikus


---
Message posted from http://www.ExcelForum.com/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Quick VB Help

Yes, instead of filling down what was in ColumnA, it
deleted what was in Column B.
-----Original Message-----
Did you try what I gave you? - Pikus


---
Message posted 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
Need Help Quick nevans Excel Discussion (Misc queries) 2 August 7th 09 03:48 PM
Quick help Helpmeeee Excel Worksheet Functions 7 October 14th 08 04:42 PM
just a quick one chris Excel Discussion (Misc queries) 1 June 11th 08 12:48 PM
Help quick nempo Excel Worksheet Functions 3 July 20th 06 10:22 PM
Quick one(I think!), LEN & IF saybut Excel Discussion (Misc queries) 4 March 17th 06 04:25 PM


All times are GMT +1. The time now is 01:08 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"