Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default change macro

I want to change this macro so result isn't in listbox but on sheet1
starting with cell E1.
Private Sub UserForm_Initialize()
Dim cell As Range
Dim sh As Worksheet

With Me
.ListBox1.RowSource = ""
.ListBox1.ColumnCount = 3
.ListBox1.Clear
End With

Set sh = Worksheets("Ark1")

For Each cell In sh.Range("A10:A250")
If cell.Value = sh.Range("A5").Value Then
With UserForm1
.ListBox1.AddItem cell.Value
.ListBox1.List(.ListBox1.ListCount - 1, 1) _
= cell.Offset(0, 2).Value
.ListBox1.List(.ListBox1.ListCount - 1, 2) _
= cell.Offset(0, 5).Value
End With
End If
Next

End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default change macro

Private Sub UserForm_Initialize()
Dim cell As Range
Dim sh As Worksheet
Dim sh1 As Worksheet
Dim i As Long

Set sh = Worksheets("Ark1")
Set sh1 = Worksheets("Sheet1")

i = 1
For Each cell In sh.Range("A10:A250")
If cell.Value = sh.Range("A5").Value Then
With sh1
.Cells(i,"A").Value = cell.Value
.Cells(i,"B").Value = cell.Offset(0, 2).Value
.Cells(i,"C").Value = cell.Offset(0, 5).Value
i = i + 1
End With
End If
Next

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alen32" wrote in message
lkaboutsoftware.com...
I want to change this macro so result isn't in listbox but on sheet1
starting with cell E1.
Private Sub UserForm_Initialize()
Dim cell As Range
Dim sh As Worksheet

With Me
.ListBox1.RowSource = ""
.ListBox1.ColumnCount = 3
.ListBox1.Clear
End With

Set sh = Worksheets("Ark1")

For Each cell In sh.Range("A10:A250")
If cell.Value = sh.Range("A5").Value Then
With UserForm1
.ListBox1.AddItem cell.Value
.ListBox1.List(.ListBox1.ListCount - 1, 1) _
= cell.Offset(0, 2).Value
.ListBox1.List(.ListBox1.ListCount - 1, 2) _
= cell.Offset(0, 5).Value
End With
End If
Next

End Sub





  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default change macro

Thanks Bob!
What I need to change if I want to display results starting with cell F10.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default change macro

This line

For Each cell In sh.Range("A10:A250")

and maybe this line?

If cell.Value = sh.Range("A5").Value Then


--
HTH

Bob Phillips

"Alen32" wrote in message
lkaboutsoftware.com...
Thanks Bob!
What I need to change if I want to display results starting with cell F10.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default change macro

I think you misunderstod me. I want to display results starting with cell
F10.
I tried this but doesn't work
from
.Cells(i,"A").Value = cell.Value
to thix
.Cells(i,"F10").Value = cell.Value



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default change macro

Private Sub UserForm_Initialize()
Dim cell As Range
Dim sh As Worksheet
Dim sh1 As Worksheet
Dim i As Long

Set sh = Worksheets("Ark1")
Set sh1 = Worksheets("Sheet1")

i = 10
For Each cell In sh.Range("A10:A250")
If cell.Value = sh.Range("A5").Value Then
With sh1
.Cells(i,"F").Value = cell.Value
.Cells(i,"G").Value = cell.Offset(0, 2).Value
.Cells(i,"H").Value = cell.Offset(0, 5).Value
i = i + 1
End With
End If
Next

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alen32" wrote in message
lkaboutsoftware.com...
I think you misunderstod me. I want to display results starting with cell
F10.
I tried this but doesn't work
from
.Cells(i,"A").Value = cell.Value
to thix
.Cells(i,"F10").Value = cell.Value



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 78
Default change macro

Now results are in cell F1,G1 and H1.
I want result in F10,G10 and H10

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
Use Macro To Change Which Macro Assigned To Command Button CVinje Excel Discussion (Misc queries) 0 May 25th 10 09:55 PM
Insert row at change macro - how to change it. cathit Excel Discussion (Misc queries) 1 March 26th 09 07:14 PM
macro that will change the font of a cell if i change a value jk Excel Discussion (Misc queries) 2 July 29th 08 04:39 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
How do I change macro text with another macro? Eric Excel Discussion (Misc queries) 4 April 27th 05 11:20 PM


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