Moving Companies

  • Thread starter Thread starter linkswanted
  • Start date Start date
In Sheet1
------------
Let's take A1 to be the cell
dependent on a random number

Put in A1: =1+RAND()



Sub TextFromOLmsg()

Const olFolderInbox = 6
Const olTxt = 0
Const ForReading = 1

Dim R As Integer

' Determine row of first available cell in "A:A"
R = Range("A65536").End(xlUp).Row + 1

Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)

Set colMailItems = objFolder.Items

Set FSO = CreateObject("Scripting.FileSystemObject")
strFileName = FSO.GetSpecialFolder(2) & "\TempMsg.txt"

Set objItem = colMailItems.GetLast()
objItem.SaveAs strFileName, olTxt

Set objFile = FSO.OpenTextFile(strFileName, ForReading)

Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
Cells(R, 1).Value = strLine
R = R + 1
Loop

objFile.Close
FSO.DeleteFile strFileName

Set objFolder = Nothing
Set objNamespace = Nothing
Set objOutlook = Nothing
Set FSO = Nothing


In Sheet2
-------------
Put in B1: =Sheet1!A1
List/fill sequentially in A2:A51, the numbers 1,2,3... 50

Select A1:B51
Click Data > Table
Leave the "row input cell:" box empty
Put in the "column input cell:" box: C1
(C1 is arbitrary, it can any cell outside the range A1:B51)
Click OK

B2:B51 will be filled with 50* iterations of
the random formula result of Sheet1's A1
*disregarding the result in B1 itself

Each press of the F9 key will regenerate
another 50 iterations in B2:B51

Now you could just freeze the randomized values
in the range B2:B51
via a copy > paste special > values in-situ or elsewhere
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Furniture Boxes moving Los Angeles movers 1
Move rows into columns 3
Server Move 15
New Guy 9
Company of Heroes bundle 8
company names 3
Excel Move or Copy Stopped Working? 0
TIFF image moves for no reason when printed 1

Back
Top