Search : in
By :

Convert value in the cell into integer

Last answer on Aug 5, 2008 5:26:54 pm BST arilla, on Aug 3, 2008 3:06:16 pm BST 
 Report this message to moderators

Hello,

I am working on creating a macro. I want to go through the sheet and take the quantity that enter in the cell and copy and insert the row as many times as the value that enter in the cell. How do I convert the number in the cell into integer so I could use it as a counter. For example, cell(1,1) has the number 4 in it, so I want to copy the entire row and paste it 4 times. My code doesn't work because when I used Cell(1,i).value it doesn't convert it into integer. Would you please tell me how do I convert the value inthe cell into integer? Thank you very much, any help would be appreciated.


Sub findQty()

Dim LastLine As Integer, i, i1 As Integer
Dim qty As Integer


Sheets("List").Activate
LastLine = Cells(Columns("A").Rows.Count, 1).End(xlUp).Row
For i = 1To LastLine

qty = (Cells(1, i).Value)
If (Cells(1, i).Value) > 1 Then

For i1 = 1 To qty


Rows("7:7").Select
Selection.Copy
Selection.Insert Shift:=xlDown
Cells(1, i).FormulaR1C1 = "1"
Next i1
End if
Next i

Configuration: Windows XP
Firefox 2.0.0.16

Best answers for « convert value in the cell into integer » in :
Converting a 32-bit integer into IP Show Converting a 32-bit integer into IP Number to convert: 3265917058 Binary representation 11000010 10101001 11110000 10000010 - 3265917058 00000000 00000000 00000000 11000010 - 3265917058 >> 24 ( 194 ) 11000010 10101001 11110000...
Representation of real numbers and integers Show Representing a number in a computer Representing (or encoding) a number means to express it in binary form. Representing numbers in a computer is necessary in order for it to be able to store and manipulate them. However, the problem is that a...
How to convert Excel into PDF? ShowHow to convert Excel into PDF? Here is a small tips about how to convert your excel files into PDF for your presentation. Step 1 PDF995 is software that gets installed on your computer which enables you to print any sources of document to...
Conversion of an IP address 32-bit ShowConversion of an IP address 32-bit We will make a ping kioskea.net in view retrieve the IP address (in bold) $ Ping-c1 kioskea.net PING kioskea.net (194,169,240,130) 56 (84) data bytes. 64 bytes from www.kisokea.org...
How to convert a video clip in .flv format and vice versa ShowIntroduction Here's a tip for you to simply convert a video clip of (almost) any format to .flv format. This trick will be useful for dealing with the video post or publish your video on the web. How to convert to and from the .flv...
Download DBF To XLS Converter ShowThis is a very useful software that will allow anyone to convert DBF files into Excel's .xls format files. Features: The user interface of the converter is very simple to comprehend and almost anyone can do it within some simple clicks. All...
Environment variables ShowEnvironment variables An environment variable is a dynamic value loaded into the memory that can be used by several processes operating simultaneously. On most operating systems, the location of some libraries or of the main system executables may...
Binary encoding ShowIntroduction to binary In the late 1930s, Claude Shannon showed that by using switches which were closed for "true" and open for "false," it was possible to carry out logical operations by assigning the number 1 to "true" and 0 for "false." This...
Graphics cards - Video cards Show2D Accelerator Cards A graphics card, sometimes called a graphics adapter, video card or graphics accelerator, is a computer component which converts digital data into a graphical form which can be displayed on a monitor. The initial role of a...

1

 Ivan-hoe, on Aug 5, 2008 5:26:54 pm BST
  • +1

Hello arilla,
use CInt to convert a numeric value into integer

qty = CInt(Cells(1, i).Value)

Ivan

Reply to Ivan-hoe