Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2006, 04:56 AM
Authorized User
 
Join Date: Sep 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to add from text values into excel cells

Here I am trying to add form data into Excel sheet 2
i written this code but giving problem
anybody suggest to me

Do While (Worksheets(2).Cells(row, col1) = "")
If Worksheets(2).Cells(row, col1) = "" And Worksheets(2).Cells(row, col2) = "" And Worksheets(2).Cells(row, col3) = "" And Worksheets(2).Cells(row, col4) = "" Then

Worksheets(2).Cells(row, col1) = name
Worksheets(2).Cells(row, col2) = datefrom
Worksheets(2).Cells(row, col3) = dateto
Worksheets(2).Cells(row, col4) = reason
Exit Sub
ElseIf Worksheets(2).Cells(row, col1) <> "" And Worksheets(2).Cells(row, col2) <> "" Then
row = row + 1
End If

Loop

 
Old September 9th, 2006, 12:53 PM
Authorized User
 
Join Date: Jul 2006
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this:

row = 1
Do Until (Worksheets(2).Cells(row, col1) = "")
If Worksheets(2).Cells(row, col1) <> "" And Worksheets(2).Cells(row, col2) <> "" Then
row = row + 1
End If
If Worksheets(2).Cells(row, col1) = "" And Worksheets(2).Cells(row, col2) = "" And Worksheets(2).Cells(row, col3) = "" And Worksheets(2).Cells(row, col4) = "" Then
Worksheets(2).Cells(row, col1) = name
Worksheets(2).Cells(row, col2) = datefrom
Worksheets(2).Cells(row, col3) = dateto
Worksheets(2).Cells(row, col4) = reason
Exit Sub
End If
Loop
End Sub

 
Old September 12th, 2006, 10:55 AM
Authorized User
 
Join Date: Sep 2006
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank U Good






Similar Threads
Thread Thread Starter Forum Replies Last Post
cells values with validation in another cell srahuf Excel VBA 1 May 30th, 2008 04:05 AM
HOW CHAGE VALUES IN CELLS DYNAMICALLY dATAGRIDVIEW hyder_master C# 2005 1 October 9th, 2007 04:13 AM
datagrid add table cells problem keyvanjan ASP.NET 1.0 and 1.1 Basics 2 August 9th, 2006 11:55 PM
update values of changed cells into database using changusee2k PHP Databases 0 March 9th, 2006 01:05 PM
Wrap text with merged cells aspadda Excel VBA 4 January 29th, 2004 03:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.